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 Checking for valid date

Hi Paul

You can use the exit event like this.
It will not leave the textbox untill the textbox is a date

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsDate(TextBox1.Text) Then
MsgBox "not a date"
Cancel = True
End If
End Sub



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



"Paul M." wrote in message ...
I'm using a userform with a textbox among other things. I
want to ensure that not only does the user submit a date
in that textbox, I want to make sure it is a valid date.
If the date is invalid, I want to display a warning
message.

Thanks for the help.

Paul