View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default disable pushbutton on spreadsheet

Hi Robert,

I have assumed that you are using an AxtiveX command button from the
Controls Toolbox toolbar. (not a button from the Forms toolbar.)

Also assumed that the form is Modeless otherwise the button is not
accessable while the form is open anyway.

Use the following code for the command button.

Private Sub CommandButton1_Click()
Me.CommandButton1.Enabled = False
UserForm1.Show vbModeless
End Sub

Insert the following code in the forms code module.

Private Sub UserForm_Terminate()
'Edit "Sheet1" to your worksheet name
Sheets("Sheet1").CommandButton1.Enabled = True
End Sub

--
Regards,

OssieMac


"Robert Crandal" wrote:

Is it possible to disable a pushbutton that is placed on
top of my spreadsheet?? Basically, if the button is
pressed I will display my userform object. If the
userform is visible/loaded, I want the button to be
disabled. Then, when the userform is closed out
I want to re-enable the button again.

thank u


.