VBA check if date is in future
Private Sub txtBirthdate_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If txtBirthdate = vbNullString Then Exit Sub
If Not IsDate(txtBirthdate) Then
MsgBox "That is not a valid birthdate."
Cancel = True
End If
If txtBirthdate Date(Now()) then
MsgBox "That date is in the future!"
Cancel = True
End If
End Sub
|