ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Refer to a control name from another sheet (https://www.excelbanter.com/excel-programming/374740-refer-control-name-another-sheet.html)

rezafloyd

Refer to a control name from another sheet
 
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


NickHK

Refer to a control name from another sheet
 
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

"rezafloyd" wrote in message
ups.com...
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





All times are GMT +1. The time now is 01:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com