Solved

Excel Macro Issue

Posted on 2011-02-23
2
296 Views
Last Modified: 2012-05-11
Good Afternoon,

I am using Office 2010. I have an excel file which I filter certain data and then run this macro:

Sub Save()
'
' Save Macro
'
' Keyboard Shortcut: Ctrl+Shift+M
'
    Sheets("Email Data").Select
    ChDir "C:\Documents and Settings\amyp\Desktop\Service Reminder (Temp)"
    ActiveWorkbook.SaveAs Filename:= _
        "C:\Documents and Settings\amyp\Desktop\Service Reminder (Temp)\Email Data.csv", _
        FileFormat:=xlCSV, CreateBackup:=False
    Sheets("Letter Data").Select
    ActiveWorkbook.SaveAs Filename:= _
        "C:\Documents and Settings\amyp\Desktop\Service Reminder (Temp)\Letter Data.csv" _
        , FileFormat:=xlCSV, CreateBackup:=False
    Sheets("Warranty Data").Select
    ActiveWorkbook.SaveAs Filename:= _
        "C:\Documents and Settings\amyp\Desktop\Service Reminder (Temp)\Warranty Data.csv" _
        , FileFormat:=xlCSV, CreateBackup:=False
    Sheets("CSI Data").Select
    ActiveWorkbook.SaveAs Filename:= _
        "C:\Documents and Settings\amyp\Desktop\Service Reminder (Temp)\CSI Data.csv", _
        FileFormat:=xlCSV, CreateBackup:=False
    Sheets("Agency Data").Select
    ActiveWorkbook.SaveAs Filename:= _
        "C:\Documents and Settings\amyp\Desktop\Service Reminder (Temp)\Agency Data.csv" _
        , FileFormat:=xlCSV, CreateBackup:=False
    Sheets("Company Data").Select
    ActiveWorkbook.SaveAs Filename:= _
        "C:\Documents and Settings\amyp\Desktop\Service Reminder (Temp)\Company Data.csv" _
        , FileFormat:=xlCSV, CreateBackup:=False
End Sub

When saving the data as a CSV file, all of the dates are changed from UK format of DD-MM-YYYY to American format of MM-DD-YYYY, even though the dates are shown in the correct UK format prior to running the macro.

Can anyone advise me as to why this is happening?
0
Comment
Question by:ali_
2 Comments
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 34962366
0
 
LVL 23

Accepted Solution

by:
Michael74 earned 500 total points
ID: 34967458
A suggestion from this forum
http://www.excelforum.com/excel-programming/381953-date-format-problem-on-export-to-csv.html

is to change the dates in the sheet to US format before the save and then for some reason excel will then change them back to UK format on the save.

Michael
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question