ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   option button? (https://www.excelbanter.com/excel-programming/339733-option-button.html)

pete

option button?
 
i have an option button on sheet1 that was created
with the forms toolbar.

how do i toggle the state of button the from within a macro.

(the option button name is "Option Button 57")


Norman Jones

option button?
 
Hi Pete,

Try:

Sub AAA()
With ActiveSheet.OptionButtons("Option Button 57")
If .Value = xlOn Then
.Value = xlOff
Else
.Value = xlOn
End If
End With
End Sub



---
Regards,
Norman



"Pete" wrote in message
...
i have an option button on sheet1 that was created
with the forms toolbar.

how do i toggle the state of button the from within a macro.

(the option button name is "Option Button 57")




Norman Jones

option button?
 
Hi Pete,

Or, more concisely,

Sub AAA2()
With ActiveSheet.OptionButtons("Option Button 57")
.Value = Not .Value = xlOn
End With
End Sub

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Pete,

Try:

Sub AAA()
With ActiveSheet.OptionButtons("Option Button 57")
If .Value = xlOn Then
.Value = xlOff
Else
.Value = xlOn
End If
End With
End Sub



---
Regards,
Norman



"Pete" wrote in message
...
i have an option button on sheet1 that was created
with the forms toolbar.

how do i toggle the state of button the from within a macro.

(the option button name is "Option Button 57")







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

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