View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Umlas[_3_] Bob Umlas[_3_] is offline
external usenet poster
 
Posts: 320
Default Optionbutton Group test

Private Sub Commandbutton1_Click()
Dim x As Control
For Each x In Me.Controls
If TypeName(x) = "OptionButton" Then If x.Value = True Then GoTo OK
Next
MsgBox "none"
Exit Sub
OK:
MsgBox "good"
End Sub


"Patrick C. Simonds" wrote in message
...
I have 7 OptionButtons on my UserForm. They are all have the same GoupName,
which is Status. Is there any way to test the Group to ensure at least 1
option is selected.

What I am looking for is a msgbox to popup saying "You must select at
least 1 option prior to continuing"

I know I can use an If Statement to check each OptionButton but thought it
would be cleaner if I could just check the Group.