Skip to content

Instantly share code, notes, and snippets.

@LeeMendelowitz
Created April 8, 2016 17:32
Show Gist options
  • 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