Hi,
In my userform, I have a textbox to enter date, I wanted to make this textbox as a mandatory field, if user tries to leave the textbox blank or not entered any date and they were trying to move next textbox it has to show error "Date is mandatory field please enter date".
I used below code but it is not working. Can anyone help me to do this please
Private Sub TextBox13_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim Response As VbMsgBoxResult
Dim IsOk As Boolean
IsOk = True
If Me.TextBox13.Value = "" Or Me.TextBox13.Value = 0 Then
MsgBox "Date is mandatory field please enter date", Title:="Date of Enrollement"
If Response = vbOK Then Me.TextBox13.SetFocus
Cancel = True
End If
End Sub
Bookmarks