Clear Option Button Selections

J

Jenny B.

Hi Again,

Is there a Macro to clear all Option Button sections?

I have one for clearing Check Boxes, but even after retooling it doesn’t
seem to work on the Option Button selections.

Thanks in advance – Jenny B.
 
J

JLatham

If the option buttons are in a userform, this would work:

Sub ClearOptionButtons()
Dim anyControl As Control
For Each anyControl In Me.Controls
If TypeName(anyControl) = "OptionButton" Then
anyControl = False
End If
Next
End Sub

If your controls are not in a form, a little more information about your
setup would be in order.
 
R

Rick Rothstein \(MVP - VB\)

Is there a Macro to clear all Option Button sections?
I have one for clearing Check Boxes, but even after retooling it doesn’t
seem to work on the Option Button selections.

If you are still using controls from the Forms Toolbar (as I think you were
in your previous posts), then this should clear them in the same way my
other code cleared the CheckBoxes...

ActiveSheet.OptionButtons.Value = False

or this (assuming your work sheet name is the same as before)...

Worksheets("background").OptionButtons.Value = False

Rick
 
Top