#1   Report Post  
Posted to microsoft.public.excel.programming
TJF TJF is offline
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatenate including a date so that the date appears as a date Zembu Excel Worksheet Functions 2 January 6th 10 06:09 PM
date in Cell to change colors if the date is beyond today's date Pete Elbert Excel Discussion (Misc queries) 2 June 6th 09 06:31 AM
Making a date go red, if date passes todays date. Jamie Excel Worksheet Functions 2 September 9th 08 02:14 PM
Report Date - Date Recv = Days Late, but how to rid completed date MS Questionnairess Excel Worksheet Functions 1 January 24th 07 11:05 PM
Date updates from worksheet to chart & changes date to a date series! Help!! Jayjg Charts and Charting in Excel 2 January 22nd 05 03:00 PM


All times are GMT +1. The time now is 03:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"