ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Referencing worksheet controls (https://www.excelbanter.com/excel-programming/347906-referencing-worksheet-controls.html)

Frederick Chow

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.



Kevin B[_5_]

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.




Frederick Chow

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