View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default get actual date from variable text string

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" wrote in message
...
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