ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable optionbutton (https://www.excelbanter.com/excel-programming/444650-disable-optionbutton.html)

Cimjet[_3_]

Disable optionbutton
 
Hi Everyone
What would be the code to disable option buttons.
I tried this but no success
ActiveSheet.Shapes("OptionButton1").enable = False
TIA
Regards
Cimjet



Cimjet[_3_]

Disable optionbutton
 
Also I forgot to mention, I would like to disable about 24 Option button, it
would be better if I could disable then all with one command if possible.
thanks
Cimjet
"Cimjet" wrote in message
...
Hi Everyone
What would be the code to disable option buttons.
I tried this but no success
ActiveSheet.Shapes("OptionButton1").enable = False
TIA
Regards
Cimjet




Rick Rothstein

Disable optionbutton
 
Also I forgot to mention, I would like to disable about
24 Option button, it would be better if I could disable
then all with one command if possible.


You also forgot to mention where you got the OptionButtons from... the Forms
toolbar or the (ActiveX) Control Toolbox toolbar. Here is code for both (the
macro name should tell you which is which)...

Sub DisableFormsOptionButtons()
Worksheets("Sheet 1").OptionButtons.Enabled = False
End Sub

Sub DisableActiveXOptionButtons()
Dim OptBtn As OLEObject
For Each OptBtn In Worksheets("Sheet 1").OLEObjects
OptBtn.Object.Enabled = False
Next
End Sub

Rick Rothstein (MVP - Excel)


Cimjet[_3_]

Disable optionbutton
 
Hi Rick
Sorry about that, I should have known better. You also forgot to mention where
you got the OptionButtons from.<<
It was an ActiveX control.
Thank you everything is working fine.
Regards
Cimjet

"Rick Rothstein" wrote in message
...
Also I forgot to mention, I would like to disable about
24 Option button, it would be better if I could disable
then all with one command if possible.


You also forgot to mention where you got the OptionButtons from... the Forms
toolbar or the (ActiveX) Control Toolbox toolbar. Here is code for both (the
macro name should tell you which is which)...

Sub DisableFormsOptionButtons()
Worksheets("Sheet 1").OptionButtons.Enabled = False
End Sub

Sub DisableActiveXOptionButtons()
Dim OptBtn As OLEObject
For Each OptBtn In Worksheets("Sheet 1").OLEObjects
OptBtn.Object.Enabled = False
Next
End Sub

Rick Rothstein (MVP - Excel)




All times are GMT +1. The time now is 07:05 PM.

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