
Add and Change Command Button Color
How to include a command button in the spreadsheet and change its color when clicking.


-Tecle Alt F11, the Visual Basic window will open, Then
-click with the right mouse button on the Project window
-Click on Insert
-Click on Module
Paste the sample code below
Sub Bota_Example_Click ()
If Worksheets ("Principal"). Shapes ("Botao_Exemplo"). Fill.ForeColor.SchemeColor = 3 Then
Worksheets ("Principal"). Shapes ("Botao_Exemplo"). Fill.ForeColor.SchemeColor = 2
Else
Worksheets ("Principal"). Shapes ("Botao_Exemplo"). Fill.ForeColor.SchemeColor = 3
EndIf
End Sub
