Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7016337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:46:17+00:00 2026-05-27T22:46:17+00:00

I have a problem working with some worksheets within a workbook from a 3rd

  • 0

I have a problem working with some worksheets within a workbook from a 3rd party website source.

  • the spreadsheet is available at the 3rd party source website
  • the worksheet I am having problems with is the EC worksheet in the all-euro-data-2009-2010.xls in that zipfile

It’s a list of football match data.

Manual Save as CSV
Now when this “EC” spreadsheet is in focus and I go to SAVE AS and choose .CSV, then spreadsheet is saved as a CSV and the data is perfect. ie the dates in column “B” and they are as they should be in DD/MM/YYYY format.

EG , taken from last row of the EC worksheet
EC,24/04/2010,Tamworth,Ebbsfleet

This is correct, if I go to the menu and choose to “SAVE AS” and chose CSV and accept all the prompts to keep it in CSV format blah blah the CSV file is save as
EC,24/04/2010,Tamworth,Ebbsfleet

This is correct as the dates are in UK dd/mm/yyyy

VBA Save as CSV
Now to make things a hell of a lot easier for myself as I need to save each worksheet off as a csv file so I am using the VBA code below to auto save each worksheet in the current directory named as worksheetname.csv ( eg EC.csv) each time the workbook is closed however this is changes the dates in column B to Americam format MM/DD/YYYY.

However using VBA to save as a CSV the data ends up like
EC,4/24/2010,Tamworth,Ebbsfleet

Notice the change from UK dd/mm/yyyy to now the American format mm/dd/yyyy

How can I make the change in the VBA to keep the dates in the format shown in the actual spreadsheet ie dd/mm/yyyy when saving in vba to CSV?

I need this CSV option to work in VBA as these and many other similar spreadsheets are saved as CSV files for importation EVERY DAY.

My settings

I am using Excel 2007, on a Win 7 (64bit) PC here in the UK.

I have also tried add the Local:=True to the ws.SaveAs but this made no difference. ie the dates still saved as EC,4/24/2010,Tamworth,Ebbsfleet when saving from VBA

Thanks

Option Explicit

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Alerts_Suppress
ThisWorkbook.Save
Save_All_WorkSheets_As_CSV
Alerts_Enable
ActiveWorkbook.Close False
Application.Quit
End Sub


Sub Save_All_WorkSheets_As_CSV()

Dim Name As String
Dim Current_Directory As String
Dim ws As Worksheet
Dim wb As Workbook
Set wb = ActiveWorkbook
Dim i As Integer
i = 0

Current_Directory = ActiveWorkbook.Path & "\"
For Each ws In wb.Worksheets
    Name = Current_Directory & LCase(ws.Name) + ".csv"
    ws.SaveAs Name, xlCSV
    i = i + 1
Next

End Sub

Sub Alerts_Suppress()
Application.DisplayAlerts = False
End Sub

Sub Alerts_Enable()
Application.DisplayAlerts = True
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:46:18+00:00Added an answer on May 27, 2026 at 10:46 pm

    This seems to be an inherent ‘problem’ with vba and I believe the only solution is to format your date field to a text field prior to exporting, obviously change Selection to the actual range

    Sub convertToStr()
      Dim c As Range
    
      For Each c In Selection
        c.Value = "'" + CStr(c.Value)
      Next c
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with my CSS on a website I'm working on .
I am working on some c# I have inherited. I have a problem in
I have some problem. I'm working with Android 2.2 and now I want to
I have a strange problem working with HTML,CSS in different browsers: Firefox 3.6 and
I'm working with oscommerce and i have problem with Paypal ipn When someone makes
I working on project and have problem with threading and update of UI. I
I have a small problem when im working with a menu and a list
i have a problem, i'm working on a gallery php script and need help,
i have a problem. I am working on a chatting application. I want to
I have a problem but first i want to know if im working on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.