Hi There,
I have a text file that i import which has about 100 or so lines like below.
"16","1/06/2004 9:39:19 AM","
"17","17/06/2004 12:29:14 PM",
When i use the "cells(row,col).value" function to insert the date, the date is reversed for ALL dates that are not in the format dd/mm/yyyy. Eg For every month of every year, the 1st through to the 9th days are written backward since the format is d/mm/yyyy
Even when debugging and hardcoding the value to a cell i find this problem:
eg
And the output is "6/01/2004" without any timestamp and date reversed (with or without the DAtevalue conversion)
But this double digit date works
=11/06/2004 9:39:19 AM
The format of the column i am retrieving all the info and saving to is of the format "Date: *14/03/2001" .
How can i change my code/imported text file so that the dates are read correctly?
edit: Read this on a website
Here's the unofficial (i.e. my) explanation. If your VBA code reads a date on a worksheet, it interprets the date in the same way as the worksheet does. But if VBA reads a date inside the code it assumes that it is written in month/day/year (i.e. US) date format. UNLESS (and there has to be a big UNLESS!) the date it reads is impossible. If it gets a date that doesn't conform to month/day/year it tries day/month/year, and if that doesn't work it tries year/month/day. If either of these work they get used.
Bookmarks