Skip to content

Instantly share code, notes, and snippets.

@syaifulnizamyahya
Last active April 23, 2016 00:56
Show Gist options
  • Select an option

  • Save syaifulnizamyahya/6ce1b6a041fd82b8c058176cf15ee606 to your computer and use it in GitHub Desktop.

Select an option

Save syaifulnizamyahya/6ce1b6a041fd82b8c058176cf15ee606 to your computer and use it in GitHub Desktop.
Save all worksheet in Excel as csv
Sub exportcsv()
Dim ws As Worksheet
Dim path As String
' Turn off warnings if the file already exists
Application.DisplayAlerts = False
path = ActiveWorkbook.path & "\" & Left(ActiveWorkbook.Name, InStr(ActiveWorkbook.Name, ".") - 1)
For Each ws In Worksheets
ws.Copy
ActiveWorkbook.SaveAs Filename:=path & "_" & ws.Name & ".csv", FileFormat:=xlCSV, CreateBackup:=False
ActiveWorkbook.Close False
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment