Saturday, May 12, 2012

Merge Series ----- Save Each sheet of a workbook as new workbook

If you want to save each worksheet of a workbook as separate new workbook and then save the new workbook with sheet name.

Download Working File

Here is the code-

Option Explicit
Sub splitsheets()
Dim wk As Worksheet, wkb As Workbook
' loop through each worksheet
For Each wk In ThisWorkbook.Sheets
' save it in new workbook
' save the new workbook with sheet name
ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & wk.Name & ".xlsx"
' close the newly created workbook
End Sub

No comments:

Post a Comment

Import data from SQL

Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...