Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date...
I heve got variable with name Example, its text. I use this varible for
entry date. Then I used: ExampleTrue = DateValue(Example) for getting true date. When Example is = 5/7/03 then ExampleTrue = 5.7.2003, but when Example is only =5/ its Error. So how can I checked if Example is good entry: dd.mm.yy Tom |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date...
Hi Tom
You can use the Isdate function to only run the code if Excel recognises the text as a date. EG If IsDate(Example) then ExampleTrue = Datevalue(example) else msgbox "invalid date" end if this displays the messgage "Invalid date" if the user does not enter something that excel recognises as a date. Hope this helps Libby -----Original Message----- I heve got variable with name Example, its text. I use this varible for entry date. Then I used: ExampleTrue = DateValue(Example) for getting true date. When Example is = 5/7/03 then ExampleTrue = 5.7.2003, but when Example is only =5/ its Error. So how can I checked if Example is good entry: dd.mm.yy Tom . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date...
Hi again
With regard to my earlier reply, you need to say If IsDate(Example) = true Libby -----Original Message----- I heve got variable with name Example, its text. I use this varible for entry date. Then I used: ExampleTrue = DateValue(Example) for getting true date. When Example is = 5/7/03 then ExampleTrue = 5.7.2003, but when Example is only =5/ its Error. So how can I checked if Example is good entry: dd.mm.yy Tom . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date...
use the isdate() function
eg If isdate(example) then ExampleTrue = DateValue(Example) else msgbox example & " is not a valid date" end if Patrick Molloy Microsoft Excel MVP -----Original Message----- I heve got variable with name Example, its text. I use this varible for entry date. Then I used: for getting true date. When Example is = 5/7/03 then ExampleTrue = 5.7.2003, but when Example is only =5/ its Error. So how can I checked if Example is good entry: dd.mm.yy Tom . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Concatenate including a date so that the date appears as a date | Excel Worksheet Functions | |||
date in Cell to change colors if the date is beyond today's date | Excel Discussion (Misc queries) | |||
Making a date go red, if date passes todays date. | Excel Worksheet Functions | |||
Report Date - Date Recv = Days Late, but how to rid completed date | Excel Worksheet Functions | |||
Date updates from worksheet to chart & changes date to a date series! Help!! | Charts and Charting in Excel |