Thread: date formatting
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default date formatting

Turn on the macro recorder and do it manually. (for Text to columns)

If you are talking about parsing a string (assuming string is yyyymmdd)

Dim dt as Date
Dim sStr as String
sStr = "20030101"
dt = DateValue(Mid(sStr,5,2) & "/" & mid(sStr,7,2) & "/" & Left(sStr,4))

Demo'd from the immediate window:
sStr = "20030101"
? DateValue(Mid(sStr,5,2) & "/" & mid(sStr,7,2) & "/" & Left(sStr,4))
1/1/03

--
Regards,
Tom Ogilvy


douvid wrote in message
...
ok but I'm want to do all that from vba. through coding