ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   userform (https://www.excelbanter.com/excel-programming/318659-userform.html)

JUlie

userform
 
Hi All,

I have a userform that contains text boxes and combo
boxes and option buttons. Is there an easy way to
determine if all the appropriate controls are filled in?

Thanks

Tom Ogilvy

userform
 
for each ctrl in userform1.controls
if ctrl.Value = "" then
msgbox "Not filled in"
end if
Next

--
Regards,
Tom Ogilvy


"Julie" wrote in message
...
Hi All,

I have a userform that contains text boxes and combo
boxes and option buttons. Is there an easy way to
determine if all the appropriate controls are filled in?

Thanks




Bob Phillips[_6_]

userform
 
Julie,

The best way is to have an OK button that checks each control. You can
either test them by name

If Textbox1.Text < "" Then ...

or in a loop

For Each ctl In Me.Controls
if ctl.Value = "" Then
... maybe do something
End If
Next ctl.

but look upon it as an opportunity, you can test the values for validity at
the same time.

--

HTH

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


"Julie" wrote in message
...
Hi All,

I have a userform that contains text boxes and combo
boxes and option buttons. Is there an easy way to
determine if all the appropriate controls are filled in?

Thanks





All times are GMT +1. The time now is 07:40 PM.

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