ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ToggleButton Value in a macro (https://www.excelbanter.com/excel-programming/373371-togglebutton-value-macro.html)

PCLIVE

ToggleButton Value in a macro
 
I can use this code when using a Private Sub ToggleButton1_Click().

Me.ToggleButton1.Value = False

However, I'm trying to use this in a standard Sub routine. When attempting
it that way, it gives me an error.

How do I use this in a standard Sub routing?

Thanks,
Paul



Tom Ogilvy

ToggleButton Value in a macro
 
in a sheet module, me refers to that sheet. In a general module, you would
have to specify the sheet that contains the toggle

Worksheets("Sheet1").ToggleButton1.Value = False

--
Regards,
Tom Ogilvy


"PCLIVE" <pclive(remove wrote in message
...
I can use this code when using a Private Sub ToggleButton1_Click().

Me.ToggleButton1.Value = False

However, I'm trying to use this in a standard Sub routine. When
attempting it that way, it gives me an error.

How do I use this in a standard Sub routing?

Thanks,
Paul




PCLIVE

ToggleButton Value in a macro
 
Thanks Tom,

I thought I had tried using the 'ActiveSheet' method, but I guess not.
Thanks for clearing up the usage of Me.
Works great now.

Thanks again.
Paul

"Tom Ogilvy" wrote in message
...
in a sheet module, me refers to that sheet. In a general module, you
would have to specify the sheet that contains the toggle

Worksheets("Sheet1").ToggleButton1.Value = False

--
Regards,
Tom Ogilvy


"PCLIVE" <pclive(remove wrote in message
...
I can use this code when using a Private Sub ToggleButton1_Click().

Me.ToggleButton1.Value = False

However, I'm trying to use this in a standard Sub routine. When
attempting it that way, it gives me an error.

How do I use this in a standard Sub routing?

Thanks,
Paul







All times are GMT +1. The time now is 10:33 AM.

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