[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

Re: get actual date from variable text string

NickHK

12/20/2006 4:42:00 AM

Richard,
Excel will generally accept date in many formats, with a suitable separator.
As Jon pointed out, 113006 would be a problem as it appears to be just a
number (or text).
However, you will have trouble with dates where the day is not unambiguous
e.g. <13.

For this, you will have to process it yourself (Left,Mid,Right) and
DateSerial.
If you cannot tell if say 12/10/2007 falls in December or October, Jon's
Option 2 is the solution.

If possible, provide the user with a UI (possibly with a calendar control)
to ensure consistent date/data entry and avoid this mess.

NickHK

"Richard" <Richard@discussions.microsoft.com> wrote in message
news:1D06EEE7-3761-41A8-94C6-8498284476FF@microsoft.com...
> I'm importing dates that are from a text field filled in by numerous
people,
> so it could be in a host of formats.
> e.g. 30-Nov-06 or 113006 or 11/30/2006 or November 30th, 2006.
>
> How can I convert to true Excel Date format?
>
> (I realize there may be no macro that gets it right all the time.)
> --
> Richard