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
wk.Copy
' save the new workbook with sheet name
ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & wk.Name & ".xlsx"
' close the newly created workbook
ActiveWorkbook.Close
Next
End Sub
Subscribe to:
Post Comments (Atom)
Import data from SQL
Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...
-
Macro to Export Range in Json Format Option Explicit Sub export_in_json_format() Dim fs As Object Dim jsonfile Dim rangetoex...
-
If you want to run SQL queries within Excel environment without connecting to any database, you can do it with creating the ADODB conn...
No comments:
Post a Comment