Hi!
I have a userform that opens when the workbook is opened, and I'm trying to put in some safeguards if the form isn't filled out completely.
I've gotten it to where the message boxes work as expected, but clicking OK just pushes the macro onward, and I'd like it to stop and return to the form so the user can return and fill it out completely.
What do I need to add to this? I'm sure it's something easy.
Thank you!!!
I have a userform that opens when the workbook is opened, and I'm trying to put in some safeguards if the form isn't filled out completely.
I've gotten it to where the message boxes work as expected, but clicking OK just pushes the macro onward, and I'd like it to stop and return to the form so the user can return and fill it out completely.
What do I need to add to this? I'm sure it's something easy.
Code:
Private Sub cmdok_Click()
If txtname = "" Then
MsgBox "Please Enter Your Name"
Else
If txtrunid = "" Then
MsgBox "Please Enter Your RunID"
Else
If txtsaveloc = "" Then
MsgBox "Please Enter Your Save Location"
Else
Worksheets(1).Range("H4") = txtname.Value
Worksheets(1).Range("H5") = txtrunid.Value
Worksheets(1).Range("B35") = txtsaveloc.Value
End If
End If
End If
Unload Me
End Sub
Thank you!!!