![]() |
Referencing worksheet controls
Hi all,
Suppose I have a command button (cmdCommandButton1) in a worksheet named "Sheet1". How can I refer to this control outside this sheet? I tried this one but didn't work: Worksheets("Sheet1").CommandButton1 Thanks for your advice. Frederick Chow Hong Kong. |
Referencing worksheet controls
Under Excel objects in the Project Explorer, select the sheet that has the
command button. You can then reference the button using the "Me" keyword. If the button is named cmd1 Me.cmd1.Select would select the comman button. -- Kevin Backmann "Frederick Chow" wrote: Hi all, Suppose I have a command button (cmdCommandButton1) in a worksheet named "Sheet1". How can I refer to this control outside this sheet? I tried this one but didn't work: Worksheets("Sheet1").CommandButton1 Thanks for your advice. Frederick Chow Hong Kong. |
Referencing worksheet controls
Sorry, some misunderstanding...
What I meant really was if cmdCommandButton1 is located on sheets other than "Sheet1". Thanks for your advice in advance. Frederick Chow "Kevin B" wrote in message ... Under Excel objects in the Project Explorer, select the sheet that has the command button. You can then reference the button using the "Me" keyword. If the button is named cmd1 Me.cmd1.Select would select the comman button. -- Kevin Backmann "Frederick Chow" wrote: Hi all, Suppose I have a command button (cmdCommandButton1) in a worksheet named "Sheet1". How can I refer to this control outside this sheet? I tried this one but didn't work: Worksheets("Sheet1").CommandButton1 Thanks for your advice. Frederick Chow Hong Kong. |
All times are GMT +1. The time now is 07:44 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com