ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   UserForm value check (https://www.excelbanter.com/excel-programming/315427-userform-value-check.html)

dan

UserForm value check
 
I have 2 text boxes and 2 combo boxes on a user form. On
Exit of each box I want to make sure the the box has a
value in it, if not stop and return to the box. I continue
to get a function not defined error. Here is my code for
one of the combo boxes (ComboBox1=January, Combobox2=2004,
Textbox 1 and 2 are keyed in text):

Private Sub cbo_Exit(ByVal Cancel as MSForms.ReturnBoolean)
Dim SStr=frmSetupForm.cboMth.Text
If IsBlank(sStr) Then
MsgBox "Please select month."
Cancel True
End If
End Sub

Thanks

Chip Pearson

UserForm value check
 
Dan,

There is no IsBlank function in VBA. Try

If sStr = "" Then


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Dan" wrote in message
...
I have 2 text boxes and 2 combo boxes on a user form. On
Exit of each box I want to make sure the the box has a
value in it, if not stop and return to the box. I continue
to get a function not defined error. Here is my code for
one of the combo boxes (ComboBox1=January, Combobox2=2004,
Textbox 1 and 2 are keyed in text):

Private Sub cbo_Exit(ByVal Cancel as MSForms.ReturnBoolean)
Dim SStr=frmSetupForm.cboMth.Text
If IsBlank(sStr) Then
MsgBox "Please select month."
Cancel True
End If
End Sub

Thanks





All times are GMT +1. The time now is 12:01 AM.

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