unticking option buttons

P

Phil Perry

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.
 
T

Tom Ogilvy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top