View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
ND Pard ND Pard is offline
external usenet poster
 
Posts: 73
Default 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