Parse Functions‎ > ‎

Sheets to CSV

SPECIFICATIONS:
  1. Save path defined by user
  2. Each sheet is saved to its own CSV file using the sheet name as the file name + DATE added

CODE

Sub SheetsToCSV()
'Jerry Beaucaire (1/25/2010)
'Save each sheet to an individual CSV file
Dim ws As Worksheet, OldDir As String

Application.DisplayAlerts = False
OldDir = CurDir       'memorizes the user's current working path
ChDir "C:\2010\"      'path to save into

    For Each ws In Worksheets
        ws.Copy
        ActiveWorkbook.SaveAs Filename:=ActiveSheet.Name & "-" & _
            Format(Date, "DD-MM-YYYY") & ".csv", FileFormat:=xlCSV, CreateBackup:=False
        ActiveWorkbook.Close
    Next ws

ChDir OldDir         'restores user's original working path
Application.DisplayAlerts = True
End Sub
























Nothing says "thanks" like a steak dinner!
PayPal - The safer, easier way to pay online!
Comments