VBA check if date is in future
I have a userform where the user will input their birthdate. I used the
IsDate function to make sure they enter a valid date. I would like to add
code to catch dates that are in the future (e.g., "If txtBirthdate.Value
Today Then...").
This is the code I have so far:
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
End Sub
|