View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Robert Crandal Robert Crandal is offline
external usenet poster
 
Posts: 309
Default disable pushbutton on spreadsheet

I do not use the CommandButton1 on my Sheet1. I am just using a regular
push button on top of my sheet which has the caption of "Button 1".

I tried using your code below, but it did not seem to work. I got a
subscript out of range error. Does my button caption need to be

"button 1" or "button_1" or something else?? I don't know what I'm
doing wrong.

thank you


"Dave Peterson" wrote in message
...

Option Explicit
Private Sub CommandButton2_Click()
'cancel button on the userform
ThisWorkbook.Worksheets("sheet1").Buttons("button 1").Enabled = True
Unload Me
End Sub
Private Sub UserForm_Initialize()
ThisWorkbook.Worksheets("sheet1").Buttons("button 1").Enabled = False
End Sub