Stop (halt, break) my vba code please...
On Jun 29, 11:52 am, Jock wrote:
The following code will show a message box if any text boxes on a user form
are empty:
Private Sub CommandButton1_Click()
Dim TB As Control
For Each TB In UserForm1.Controls
If TB.Name Like "TextBox*" Then
If TB.Value = "" Then
MsgBox ("Please fill all boxes")
End If
End If
Next
I would like the code to then stop once the "ok" button on the message box
is hit. Currently, it continues once the button is clicked.
I've lost some hair over this one.....
--
tia
Jock
If you want the code to "stop" you can simply add an Exit Sub
statement where appropriate. Keep in mind that it partially depends
on whether you want the information on the form to be in memory or
not. Search the VBE Help for Unload and Hide for starters.
Matt
|