Active XAre they Forms buttons or ActiveX buttons?
Public Sub SetGray()
button1.BackColor = RGB(66, 66, 66)
Button2.BackColor = RGB(66, 66, 66)
Button3.BackColor = RGB(66, 66, 66)
Button4.BackColor = RGB(66, 66, 66)
Button5.BackColor = RGB(66, 66, 66)
Button6.BackColor = RGB(66, 66, 66)
Button7.BackColor = RGB(66, 66, 66)
Button8.BackColor = RGB(66, 66, 66)
Button9.BackColor = RGB(66, 66, 66)
Button10.BackColor = RGB(66, 66, 66)
Button11.BackColor = RGB(66, 66, 66)
Button12.BackColor = RGB(66, 66, 66)
End Sub
' Repeat the following sub for each button
Public Sub Button1_Click()
SetGray
button1.BackColor = RGB(198, 89, 17)
End Sub
Sub UpdateButtonsColors()
Dim oBtn As OLEObject, oAcc As IAccessible
For Each oBtn In ActiveSheet.OLEObjects
With oBtn
If TypeOf .Object Is CommandButton Then
If Not IsError(Evaluate("=MONTH(1&""" & .Object.Caption & """)")) Then
Set oAcc = .Object
If oAcc.accState(0&) = &H100004 Then
.Visible = False
.Object.BackColor = RGB(198, 89, 17)
.Visible = True
Else
.Object.BackColor = &H8000000F
End If
End If
End If
End With
Next
End Sub