ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   unticking option buttons (https://www.excelbanter.com/excel-programming/271438-unticking-option-buttons.html)

Phil Perry

unticking option buttons
 
I've had the following code suggested for clearing
option buttons (so they are made 'unchecked').

for each oleObje in ActiveSheet.OleObjects
if typeof oleObje.Object is MSforms.OptionButton then
oleObj.Object.Value=False
End If
Next

while the code is accepted, it doesn't do the job (i.e.
the boxes remain checked). Not sure if I'm meant to be
adding more code to make this work. Your help will be
appreciated.
Thank you.

Tom Ogilvy

unticking option buttons
 
Here is what I posted:

for each oleObj in ActiveSheet.OleObjects
if typeof oleObj.Object is MSforms.OptionButton then
oleObj.Object.Value = False
End if
Next

Look at what you posted. Note that you have changed the spelling on two of
the three occurances of oleObj ( to oleObje) but not on the third occurance
which is where the box is unchecked.


Cleaned up what you posted and tested:

Sub Tester5()
For Each oleObje In ActiveSheet.OLEObjects
If TypeOf oleObje.Object Is MSForms.OptionButton Then
oleObje.Object.Value = False
End If
Next

End Sub

Tested in Excel 2000 and worked fine


Regards,
Tom Ogilvy



"Phil Perry" wrote in message
...
I've had the following code suggested for clearing
option buttons (so they are made 'unchecked').

for each oleObje in ActiveSheet.OleObjects
if typeof oleObje.Object is MSforms.OptionButton then
oleObj.Object.Value=False
End If
Next

while the code is accepted, it doesn't do the job (i.e.
the boxes remain checked). Not sure if I'm meant to be
adding more code to make this work. Your help will be
appreciated.
Thank you.





All times are GMT +1. The time now is 01:32 AM.

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