View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Checking a userform for blanks

Wrong syntax

Dim ctl

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

--

HTH

RP
(remove nothere from the email address if mailing direct)


"WillRn" wrote in message
...
So far so good, but I keep getting: "Run-Time error '450' wrong number of
arguments or invalid property assignment.

"Bob Phillips" wrote:

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


--

HTH

RP
(remove nothere from the email address if mailing direct)


"WillRn" wrote in message
...
This worked for checking the form, but I would really like the code to

take
the user to the missing answer and ask them to fill it in. Is this

possible?

"Bob Phillips" wrote:


For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Then
If ctl.Text = "" Then
Msgbox "Missing answer"
Exit For
End If
End If
Next ctl

--

HTH

RP
(remove nothere from the email address if mailing direct)


"WillRn" wrote in message
...
Does anyone know of a web site, tutorial, or bit of code I can

attach
to a
button to check its userform for blanks (no entry). I would like

form
to
check to see if there are any missing answers and if every

question
has
been
answered, then it posts the values to the spreadsheet.

I've tried a few things , and made a lot of searches, but all for

naught.

Thanks,

WillRn