View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] porky2j@hotmail.com is offline
external usenet poster
 
Posts: 13
Default code to check OptionButton selected within multiple frames

Hi Guys,

I am a total newbie to this and the group has been really helpful in
learning so far!

I am setting up a UserForm that has multiple frames containing
different OptionButtons.

When the OK button is clicked I want it to be coded to check that each
frame has an OptionButton Selected. Is it possible to write this code
referring to the frame (i.e. group of OptionButtons) or do I have to
write the code including each individual OptionButton like below:

If Me.OptionButton1.Value = False And Me.OptionButton2.Value = False
And _
Me.OptionButton3.Value = False And Me.OptionButton4.Value = False
Then
MsgBox " you must select a squad ", vbExclamation, "Input
Error"
Exit Sub
End If

I have 20 option buttons in one frame so just wondering if there is a
shorter way to write the code?

Thanks in advance
Paul