View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Date Validation?

Hi

This is working for me

I will not leave the textbox until you fill in a date

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If IsDate(TextBox1) = False Then
Cancel = True
MsgBox "Not a valid date."
Else
MsgBox "Valid date"
End If
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"R-Enemy" wrote in message ...
I have a text box for dates. How do I validate whether it
is a date or not? I have tried the isDate() function and
it seems to return false sometimes and true other times. I
want to use either mm/dd/yy or mm/dd/yyyy format, it
doesn't matter. If anyone has used TaxCut, their textboxes
automatically places the "/" while typing and wont let you
put anything in other than a valid number, this forces the
correct mm/dd/yyyy format. Is this possible with VB.

Thanks for any help.