ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Checking a userform for blanks (https://www.excelbanter.com/excel-programming/316511-checking-userform-blanks.html)

WillRn

Checking a userform for blanks
 
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

Bob Phillips[_6_]

Checking a userform for blanks
 

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




WillRn

Checking a userform for blanks
 
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





Bob Phillips[_6_]

Checking a userform for blanks
 
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







WillRn

Checking a userform for blanks
 
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







Bob Phillips[_6_]

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










All times are GMT +1. The time now is 06:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com