Thread: Text to date
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Sam Wilson Sam Wilson is offline
external usenet poster
 
Posts: 523
Default Text to date

You can use a formula: =TEXT(A1,"0000")

or in VBA:
dim strDate as string
strDate = Format(Range("A1"),"0000")

Sam


"jschping" wrote:

Hi,

I am receiving date data in the following format: MM-YY, however, for some
reason there is no first zero. So June 2009 is just 609.

How can I convert it to a date, when I don't know if I'll have 3 digits
there (like the above example) or 4 digits (for example 1109 would be
November 2009).

Thanks!