Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 316
  • Last Modified:

Excel Macro Issue

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
ali_
Asked:
ali_
1 Solution
 
SiddharthRoutCommented:
0
 
Michael FowlerSolutions ConsultantCommented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now