I have a userform with rules set up in the code to check to see if when certain options are selected, then to check to make sure that text was entered in the textboxes.
the validation runs fine and my msgbox appears (through a macro that the userform code calls) but when you click ok in the msg box, the msgbox and the form closes.
i want it to go back to the form (preferably where it was when we left it for the msgbox).
here are the codes:
FOR THE USERFORM:
FOR THE MSGBOX:
any help is greatly appreciated. thanks!
the validation runs fine and my msgbox appears (through a macro that the userform code calls) but when you click ok in the msg box, the msgbox and the form closes.
i want it to go back to the form (preferably where it was when we left it for the msgbox).
here are the codes:
FOR THE USERFORM:
Code:
Private Sub OKButton_Click()
Application.ScreenUpdating = False
'exit if a range is not selected
If TypeName(Selection) <> "Range" Then Exit Sub
'marks iInfo as active request
If II Then
ActiveSheet.Cells(ActiveCell.Row, 6).Select
ActiveCell.Value = "X"
ElseIf Not II Then
ActiveSheet.Cells(ActiveCell.Row, 6).Select
ActiveCell.Value = ""
End If
'marks Webrecon as active request
If WR Then
ActiveSheet.Cells(ActiveCell.Row, 7).Select
ActiveCell.Value = "X"
ElseIf Not WR Then
ActiveSheet.Cells(ActiveCell.Row, 7).Select
ActiveCell.Value = ""
End If
'shows message box if acct and loc are empty
If SM Or SL Or ML Then errormsg
Unload WebOrderRole
End Sub
FOR THE MSGBOX:
Code:
Sub errormsg()
'gives error message if account and location feilds are empty
If ActiveSheet.Cells(ActiveCell.Row, 10).Value = "" And ActiveSheet.Cells(ActiveCell.Row, 11).Value = "" Then
ans = MsgBox("Account and Location numbers must be provided!", vbCritical + vbOKOnly)
End If
End Sub
any help is greatly appreciated. thanks!