Extract Excel Sheets from a Workbook

Export And Save individual sheets from a workbook using a macro (VBA Code)

This following code will export every visible worksheet into a new workbook and save the workbook with the name of the original sheet in a newly created folder in the same path as the active workbook. Follow the steps below:
Step 1: Go to File > Options and down to Customize the Ribbon and make sure the Developer option is ticked.
Step 2: Go to the Developer Tab
Step 3: Click Visual Basic
Step 4: Right click on This Workbook
Step 5: Click Insert > Module
Step 6: Paste the following code into the window

Sub SplitWorkbook()
Dim FileExtStr As String
Dim FileFormatNum As Long
Dim xWs As Worksheet
Dim xWb As Workbook
Dim FolderName As String
Application.ScreenUpdating = False
Set xWb = Application.ThisWorkbook
DateString = Format(Now, "yyyy-mm-dd hh-mm-ss")
FolderName = xWb.Path & "" & xWb.Name & " " & DateString
MkDir FolderName
For Each xWs In xWb.Worksheets
    If Val(Application.Version) 

Share and Enjoy !


Similar Posts

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.