Last active
April 23, 2016 00:56
-
-
Save syaifulnizamyahya/6ce1b6a041fd82b8c058176cf15ee606 to your computer and use it in GitHub Desktop.
Save all worksheet in Excel as csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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