Hi,
I have a userform to enter a start date for my sheet, what I would like to do is to have a check to see if the date that has been entered is a valid date. If the date is not valid then a messagebox to state that the date is not valid.
Here is the code for the userform.
Regards
I have a userform to enter a start date for my sheet, what I would like to do is to have a check to see if the date that has been entered is a valid date. If the date is not valid then a messagebox to state that the date is not valid.
Here is the code for the userform.
Code:
Private Sub Confirm_Click()
On Error Resume Next
If Not (Me.DateSel.Text Like "##/##/##") Then
Cancel = True
MsgBox "Invalid date entered, start date has not been changed", vbOKOnly, "Invalid Date"
Exit Sub
End If
Run "Unprotect"
Sheets("Holidays").Range("D18") = CDate(Me.DateSel.Value)
Run "Month"
Run "Protect"
Unload Me
End Sub
Regards