Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, I'll try that. I think my problem might be that I
set a variable to the textbox.text and then did the isDate function. Like this: Dim a as String if isDate(a) = false then call msgbox("invalid date") textbox1.setFocus End if I like the not being able to exit until valid. Thanks. -----Original Message----- 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. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
DATE VALIDATION | Excel Discussion (Misc queries) | |||
date validation | Excel Worksheet Functions | |||
Date Validation | Excel Worksheet Functions | |||
Date Validation - Must equal Sundays date | Excel Discussion (Misc queries) | |||
Date validation | Excel Discussion (Misc queries) |