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 Format(txtBirthdate, "#.00") Format(Now(), "#.00") Then
MsgBox "That date is in the future!"
Cancel = True
End If
End Sub
|