ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dates changing when opening a CSV (https://www.excelbanter.com/excel-programming/418298-dates-changing-when-opening-csv.html)

Skeniver

Dates changing when opening a CSV
 
Hi there

I am opening a CSV file with a bank account statement details in. Excel is
changing the date for mat for some of the dates (but not all of them). So
01/08/2008 (1 Aug 08) is becoming 08/01/2008 (8 Jan 08), but this only
happens for dates before the 12th of every month. It's really irritating! If
I open the CSV manually, it works fine, but with my macro it changes. I can't
figure out a solution...

PLEASE HELP!

ps. I am using Office 2003.

Dave Peterson

Dates changing when opening a CSV
 
Rename your .csv file to .txt.

Then open excel and use File|Open to open the text file.

You'll see a text import wizard appear where you can specify each
field--including the order of the date fields.

Skeniver wrote:

Hi there

I am opening a CSV file with a bank account statement details in. Excel is
changing the date for mat for some of the dates (but not all of them). So
01/08/2008 (1 Aug 08) is becoming 08/01/2008 (8 Jan 08), but this only
happens for dates before the 12th of every month. It's really irritating! If
I open the CSV manually, it works fine, but with my macro it changes. I can't
figure out a solution...

PLEASE HELP!

ps. I am using Office 2003.


--

Dave Peterson

Leo Mazzi[_2_]

Dates changing when opening a CSV
 
Since you are not specifying the format of the date, Excel tries to figure it
out by itself. Seems that the default date format Excel is using (I belive
that this depends on your regional settings) is month/day/year. For dates
where there is no problem in conversion (because you have 12 days and 12
months) it selects the default format - otherwise it tries to figure out the
possible format so it tries to use day/month/year.

Unfortunately for you all your dates are in the format day/month/year :)

I belive that the solution that Dave gave you will fix the problem - script
the procedure and you'll have the correct macro :)

Best regards,
Leo

"Skeniver" wrote:

Hi there

I am opening a CSV file with a bank account statement details in. Excel is
changing the date for mat for some of the dates (but not all of them). So
01/08/2008 (1 Aug 08) is becoming 08/01/2008 (8 Jan 08), but this only
happens for dates before the 12th of every month. It's really irritating! If
I open the CSV manually, it works fine, but with my macro it changes. I can't
figure out a solution...

PLEASE HELP!

ps. I am using Office 2003.



All times are GMT +1. The time now is 02:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com