Control Box Option Buttons

J

jlarkin

Hey..

I need some help here . . . It's probably something very simple but
dont have the know-how.

How do you clear Option Boxes (the control box type) I know how t
group them by group name -- but once selections have been made, yo
cannot RESET or CLEAR the boxes. I really want to make a Button to ru
a Macro that clears a form.

Any help would be GREATLY appreciated
 
J

Jake Marx

Hi jlarkin,

I've never tried to do this before, so maybe there's an easier way. But you
can create another OptionButton, make its GroupName the same as the others,
and set its Visible property to False. Then, in the CommandButton's Click
event, you can set the Value of that hidden OptionButton to True. That will
force the others to be False (cleared).

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
B

Bob Phillips

Something like

With ActiveSheet
.OptionButton1.Value = False
.OptionButton2.Value = False
.OptionButton3.Value = False
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
J

Jake Marx

Jake said:
I've never tried to do this before, so maybe there's an easier way.
But you can create another OptionButton, make its GroupName the same
as the others, and set its Visible property to False. Then, in the
CommandButton's Click event, you can set the Value of that hidden
OptionButton to True. That will force the others to be False
(cleared).

Wow, my fault! I swear I tried setting the Values to False, but I must have
missed something. Per Bob's response, you should be able to set the values
to False. Anyway, here's a routine that will "clear" all TextBoxes,
CheckBoxes, and OptionButtons:

Private Sub CommandButton1_Click()
Dim ctl As Control

For Each ctl In Controls
If TypeOf ctl Is msforms.OptionButton Or _
TypeOf ctl Is msforms.CheckBox Then
ctl.Value = False
ElseIf TypeOf ctl Is msforms.TextBox Then
ctl.Object.Text = vbNullString
End If
Next ctl
End Sub

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
Top