Skip to content

Instantly share code, notes, and snippets.

@LeeMendelowitz
Created April 8, 2016 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LeeMendelowitz/a82fe961019a4f60c5b7c380b8cb1de4 to your computer and use it in GitHub Desktop.
Save LeeMendelowitz/a82fe961019a4f60c5b7c380b8cb1de4 to your computer and use it in GitHub Desktop.
Excel Macro for exporting all sheets as csv
Sub ExportSheetsToCSV()
Dim xWs As Worksheet
Dim xcsvFile As String
For Each xWs In Application.ActiveWorkbook.Worksheets
xWs.Copy
xcsvFile = xWs.Name & ".csv"
Application.ActiveWorkbook.SaveAs Filename:=xcsvFile, _
FileFormat:=xlCSV, CreateBackup:=False
Application.ActiveWorkbook.Saved = True
Application.ActiveWorkbook.Close
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment