Solved

Excel Macro Issue

Posted on 2011-02-23
2
273 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

746 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now