View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
WillRn WillRn is offline
external usenet poster
 
Posts: 50
Default Checking a complex userform for blank entries

As always, thanks Tom.

Just one question though, how do I get it to check a group of optionbuttons
(controls that have the same GroupName). In other words, the question has
three option buttons assigned in a group. Only one of the three buttons need
be checked/answered. e.g. yes, no, NA.

The user checks "Yes," one of the questions in the GroupName has been
answered so the code goes to the next group of controls or textbox, . . . etc.

"Tom Ogilvy" wrote:

For Each ctl In Me.Controls

If Typeof ctl is MSForms.TextBox Then
If ctl.Text = "" Then
MsgBox "Missing answer, please complete"
ctl.SetFocus
Exit For
End If
ElseIf TypeOf ctl is MSforms.combobox then

ElseIf TypeOf ctl is MSForms.Checkbox then

end if
Next ctl

--
Regards,
Tom Ogilvy

"WillRn" wrote in message
...
I have a complex userform that I would like to be checked for blank

entries
upon posting. The following code does great as long as I am just looking

at
Textboxes or just one kind of control.

Dim ctl

For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Then
If ctl.Text = "" Then
MsgBox "Missing answer, please complete"
ctl.SetFocus
Exit For
End If
End If
Next ctl

However, my user form has several comboboxes and several groups of
OptionButtons (Yes, No, NA) that I would like checked also. Is there any

way
to check everything on the page at once?

WillRn