Refer to a control name from another sheet

  • Thread starter Thread starter rezafloyd
  • Start date Start date
R

rezafloyd

Dear experts,
I embed a command button on sheet1 on a an excel workbook.
I'd like to change it's 'enabled' property at run time from a code in
sheet2.
How can I refer to it's name? (ex. 'worksheets(1).commandbutton.enabled
=false' doesn't work)
Regards,
reza
 
Sure it's called "commandbutton" ?

This works for me:

'This is on Worksheets(2)
Private Sub CommandButton1_Click()
Worksheets(1).CommandButton1.Enabled = False
End Sub

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top