EXCEL TOGGLE BUTTON

1,682 Views

EXCEL TOGGLE BUTTON WITH COLOR CHANGE

sometimes people click the button and they don’t know after some time button is pressed or not when the colour change the button toggling to know what is current states of my button that’s why to make this button using excel macro code (VBA).


Here is code


http://www.yawot.com/
Sub ON_BUTTON()

'Macro By ExcelChamps.com

'Select Button
Worksheets(1).Shapes("Button").Select
' Change Position, Color & Text
With Selection
.ShapeRange.IncrementLeft 1
.ShapeRange.Fill.ForeColor.RGB = RGB(0, 153, 0)
End With


Worksheets(1).Shapes("Button").OnAction = "OFF_BUTTON"


Worksheets(1).Range("A1").Activate

End Sub
Sub OFF_BUTTON()


Worksheets(1).Shapes("Button").Select

' Change Position, Color & Text
With Selection
.ShapeRange.IncrementLeft -1
.ShapeRange.Fill.ForeColor.RGB = RGB(255, 0, 0)
End With

Worksheets(1).Shapes("Button").OnAction = "ON_BUTTON"


Worksheets(1).Range("A1").Activate

End Sub


\
7000cookie-checkEXCEL TOGGLE BUTTON

Author: yawot

Leave a Reply

Your email address will not be published. Required fields are marked *