Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Look at the Isdate function.
Use the exit event for validating the textbox and also use the event code for the buttons you are using to close the userform. -- Regards, Tom Ogilvy "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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Fantastic !!!...Thanks Ron and Tom, it works like a dream.
-----Original Message----- 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 . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Paul,
Here is one approach If IsDate(Me.TextBox1.Text) Then 'do your stuff Else MsgBox "That's not a date" Me.TextBox1.SetFocus End If Be careful though, dates are riddled with international issues. For instance, I am in the UK, and if I enter 12/16/2003 which is really invalid, it treats it as 16/12/2003 and is valid. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
checking hyperlinks are valid | Excel Discussion (Misc queries) | |||
checking hyperlinks are valid | Excel Discussion (Misc queries) | |||
checking hyperlinks are valid | Excel Discussion (Misc queries) | |||
checking hyperlinks are valid | Excel Discussion (Misc queries) | |||
Checking If Hyperlink Is Valid | Excel Programming |