Friday, August 31, 2018

Export and save multiple worksheet as new workbook in excel


If you have multiple excel sheet in a workbook and want to export and save all sheet to individual workbook then just follow below instructions-

Open Visual basic editor by pressing alt+F11
On project window at left side => right click on project => insert=>Module.
now paste below code. read comments and set your parameter.

Sub exportcsv()
Dim ws As Worksheet
Dim path As String

path = ActiveWorkbook.path & "\" & Left(ActiveWorkbook.Name, InStr(ActiveWorkbook.Name, ".") - 1)
For Each ws In Worksheets
    ws.Activate
    ActiveWorkbook.SaveAs Filename:=path & "_" & ws.Name & ".csv", FileFormat:=xlCSV, CreateBackup:=False
Next
End Sub

2 comments:

  1. Outsourcing to Eastern Europe has a range of advantages due to its attractive cost-to-quality ratio. I would recommend checking out this article to learn more about Python development companies in Poland.

    ReplyDelete
  2. https://www.programingtutorial.com/

    ReplyDelete