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 |
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 . |
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 . |
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 . |
All times are GMT +1. The time now is 06:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com