Disable/Enable button in Excel/VBA
... I don't know if you're using an activex button or not, but when I insert an activex button into sheet1 in Excel called CommandButton1, the following code works fine:
Sub test()
Sheets(1).CommandButton1.Enabled = False
End Sub
Hope this helps...
The following works for me (Excel 2010)
Dim b1 As Button
Set b1 = ActiveSheet.Buttons("Button 1")
b1.Font.ColorIndex = 15
b1.Enabled = False
Application.Cursor = xlWait
Call aLongAction
b1.Enabled = True
b1.Font.ColorIndex = 1
Application.Cursor = xlDefault
Be aware that
.enabled = False
does not gray out a button.
The font color has to be set explicitely to get it grayed.
too good !!! it's working and resolved my one day old problem easily
Dim b1 As Button
Set b1 = ActiveSheet.Buttons("Button 1")
b1.Enabled = False