View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default Control Box Option Buttons

Jake Marx wrote:
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]