How to Split Excel Sheet into Multiple Files (3 Quick Methods)

 

Method 1 – Manual Approach to Split Excel Sheet into Multiple Files

Method 1.1 Using Copy and Paste Options

In the following dataset, we have sales data of five people for four years in four different worksheets. Suppose we want to split each Excel sheet of the workbook into a separate file.

Using Copy and Paste Options

STEPS:

  • Click on the sheet 2019.
  • Click on the triangular Select all button on the top left corner or press Ctrl + A to select the table.
  • Select Copy from the Home tab or press Ctrl + C to copy the entire selected sheet.

Using Copy and Paste Options

  • Open a new worksheet (Excel file).
  • Select cell A1 or the entire worksheet by clicking on the triangular select all button.
  • Press Ctrl + V to paste the copied data.
  • Save the workbook.

  • Repeat for the other sheets.

This method is not only inefficient but also time-consuming.


Method 1.2 Applying Move or Copy Feature

STEPS:

  • Right-click on the sheet named 2019.
  • Select the option ‘Move or Copy’.

Apply ‘Move or Copy’ Feature

  • The above command will open a new pop-up window named ‘Move or Copy’.
  • Select the option (new book) from the To book drop-down list.
  • Check the option Create a Copy and click on OK.

Apply ‘Move or Copy’ Feature

  • A copy of the worksheet 2019 will open in a new worksheet.

  • Repeat for other sheets.

This method is slightly faster than copy-pasting.


Method 2 – Running VBA Macro to Split Excel Sheet into Multiple Files

Before you can use the code:

  • Make a folder to store the output files.
  • Save the main Excel file in the newly created folder.

Method 2.1 Splitting Into Multiple Excel Files

STEPS:

  • Save the main Excel file as ‘Split Excel Sheet.xlsx’ in the newly made folder.

Into Multiple Excel Files

  • Open the original workbook.

Into Multiple Excel Files

  • Go to the Developer tab and select the option ‘Visual Basic’ from the ribbon, or press Alt + F11.

Into Multiple Excel Files

  • This will open the VBA editor.
  • Right-click on any sheet from the section ‘Microsoft Excel Objects’.
  • Select the option Insert and click on Module.

Into Multiple Excel Files

  • This will open a blank VBA code window. Copy the following code in the blank code window:
Sub Split_Sheet_into_ExcelFiles()
Dim FilePath As String
FilePath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each Sheet In ThisWorkbook.Sheets
Sheet.Copy
Application.ActiveWorkbook.SaveAs Filename:=FilePath & "\" & Sheet.Name & ".xlsx"
Application.ActiveWorkbook.Close False
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
  • Click on the Run button or press the F5 key to run the code.

  • This splits all the sheets of our original workbook into individual Excel files. The newly separated Excel files are put in the same folder as the original workbook.


Method 2.2 Splitting Into Multiple PDF Files

In this method, we will split the Excel worksheets into multiple PDF files.

Into Multiple PDF Files

STEPS:

  • Go to the Developer tab and select the option ‘Visual Basic’ from the ribbon, or press Alt + F11. The VBA editor will open.

Into Multiple PDF Files

 

  • Right-click any object in the ‘Microsoft Excel Objects‘ area.
  • Select Insert and click on the option Module.

Into Multiple PDF Files

  • Copy the following code in the code window:
Sub Split_Sheet_into_PDF()
Dim FilePath As String
FilePath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each Sheet In ThisWorkbook.Sheets
Sheet.Copy
Application.ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, Filename:=FilePath & "\" & Sheet.Name & ".xlsx"
Application.ActiveWorkbook.Close False
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
  • Click on the Run button or press the F5 key.

  • The Excel sheets will be separated in PDF format in the folder with the original file.


Method 3 – Using VBA to Split Excel Sheets Containing Specific Word or Phrase into Multiple Files

From the following dataset, we will separate the sheets that only contain text 22 in their name.

Split Worksheets Containing Specific Word or Phrase with Excel VBA

STEPS:

  • Go to the Developer and select the option ‘Visual Basic’. Alternatively, press Alt + F11.

Split Worksheets Containing Specific Word or Phrase with Excel VBA

  • The VBA editor will pop up.
  • In the ‘Microsoft Excel Objects‘ box, right-click on any object.
  • Select Insert and click on the option Module.

Split Worksheets Containing Specific Word or Phrase with Excel VBA

  • A new blank VBA code window will appear. Insert the following code in that code window:
Sub Split_Sheet_Specific_Word()
Dim FilePath As String
Dim Find As String
Find = "22"
FilePath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each Sheet In ThisWorkbook.Sheets
If InStr(1, Sheet.Name, Find, vbBinaryCompare) <> 0 Then
Sheet.Copy
Application.ActiveWorkbook.SaveAs _
Filename:=FilePath & "\" & Sheet.Name & ".xlsx"
Application.ActiveWorkbook.Close False
End If
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
  • Click on the Run button or press the F5 key.

  • The sheet with 22 in its name has been isolated into the folder alongside the original file.


Download Practice Workbook

You can download the practice workbook from here.


Related Articles


<< Go Back to Split Excel Cell | Excel Worksheets | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Mukesh Dipto
Mukesh Dipto

Mukesh Dipto is an excellent marine engineer who loves working with Excel and diving into VBA programming. For him, programming is like a superhero tool that saves time when dealing with data, files, and the internet. His skills go beyond the basics, including Rhino3D, Maxsurf C++, AutoCAD, HTML, CSS, JavaScript, and WordPress. He got his B.Sc in Naval Architecture & Marine Engineering from BUET, and now he's switched gears, working as a content developer. In this role, he... Read Full Bio

4 Comments
  1. I received the error message “Run-time error ‘1004’: We couldn’t copy this sheet.

    When I clicked Debug, the line Sheet.Copy was highlighted in the code.

    What am I doing wrong?

    • Hello LINDSEY SERVE,
      Sorry to hear about the problem you are facing. Have you tried it with the Practice Workbook? I tried it again and it still works. Are you trying it with your own workbook? Then, I think there could be some issues with this file. I could help you if you share it with us in the mail ID [email protected]. Thanks again.
      Regards,
      Shahriar Abrar Rafid
      Excel & VBA Content Developer
      Team ExcelDemy

  2. I received the error message “Run-time error ‘1004’: We couldn’t copy this sheet.”

    When I clicked Debug, the line “Sheet.Copy” was highlighted in the code.

    What am I doing wrong?

    • Hello LINDSEY SERVE,
      Sorry to hear about the problem you are facing. Have you tried it with the Practice Workbook? I tried it again and it still works. Are you trying it with your own workbook? Then, I think there could be some issues with this file. I could help you if you share it with us through the mail [email protected]. Thanks again.
      Regards,
      Shahriar Abrar Rafid
      Excel & VBA Content Developer
      Team ExcelDemy

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo