ExcelBanter

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

Dawn

UserForm help....
 
I am trying to get a message box to appear when the user doesn't fill in
required information. The following will do that, however, if the userform is
closed, the message will still show up..I am new at all of this so any help
would be greatly appreciated.

Thanks in advance.
Dawn


Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)

Dim mybox As String
mybox = TextBox1.Text
If Not IsEmpty(mybox) And mybox = "" Then
MsgBox "Enter KanBan Number", vbOKOnly

Cancel = True

Else
End If
End Sub


Bob Phillips[_6_]

UserForm help....
 
Dawn,

Not quite clear. How does the MsgBox show up? If the form is not up, that
code should never execute. The code is in the userform is it not?

--

HTH

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


"Dawn" wrote in message
...
I am trying to get a message box to appear when the user doesn't fill in
required information. The following will do that, however, if the userform

is
closed, the message will still show up..I am new at all of this so any

help
would be greatly appreciated.

Thanks in advance.
Dawn


Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)

Dim mybox As String
mybox = TextBox1.Text
If Not IsEmpty(mybox) And mybox = "" Then
MsgBox "Enter KanBan Number", vbOKOnly

Cancel = True

Else
End If
End Sub




Dawn

UserForm help....
 
You are right..the form is up, but if they click cancel to start over(clears
contents) it will show up, also if they click the x to close the userform it
will pop up again.

"Bob Phillips" wrote:

Dawn,

Not quite clear. How does the MsgBox show up? If the form is not up, that
code should never execute. The code is in the userform is it not?

--

HTH

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


"Dawn" wrote in message
...
I am trying to get a message box to appear when the user doesn't fill in
required information. The following will do that, however, if the userform

is
closed, the message will still show up..I am new at all of this so any

help
would be greatly appreciated.

Thanks in advance.
Dawn


Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)

Dim mybox As String
mybox = TextBox1.Text
If Not IsEmpty(mybox) And mybox = "" Then
MsgBox "Enter KanBan Number", vbOKOnly

Cancel = True

Else
End If
End Sub






All times are GMT +1. The time now is 04:54 PM.

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