How to Split Each Excel Sheet Into a Separate File by One Click

1. Introduction

Here in this article, I have explained How can we split each Excel Sheet into a Separate File by doing a single click. Some of my subscribers were searching the solution to this problem, but they are unable to do this. He has a file where it has 100 Excel Sheet in a Single file, now he was asking that can we convert all the sheets and their data also in Single-Single file automatically, I said yes you can do it with an easy single click but we need a VBA code for automatically doing this task.

2. Purpose

We can separate the sheet into single files manually also but it is very time taking work. if someone has 1000 Excel Sheets in a File and wanted to convert All 1000 Sheets into Single- Single file separately and do it manually then it will take almost 2 days to convert. So our purpose to is how to do this task within 1 or 2 minutes. Raw Data Split Each Excel Sheet Into a Separate File by One Click

3. Command Used

Here to Solve this problem we have used a VBA code which I have given below, you just copy & paste into your excel VBA application. Just Open your file then Press “ALT+F11” to open VBA Application by shortcut then Go to the Insert Tab then click on the “Module” button. Now Copy the below code and paste in the Module blank page. Now finally you have to Run the code by pressing the F5 button or directly clicking in Run button on top of the menu. and now you all sheets will start to convert in  Single- Single file separately and automatically. remember – Your all files will be saved where your big file is already saved. means the same path you have to check to find the exported files. Data after export Split Each Excel Sheet Into a Separate File by One Click

VBA for Split Each Excel Sheet Into a Separate File

Sub SplitEachWorksheet()
Dim FPath As String
FPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each ws In ThisWorkbook.Sheets
ws.Copy
Application.ActiveWorkbook.SaveAs Filename:=FPath & "\" & ws.Name & ".xlsx"
Application.ActiveWorkbook.Close False
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

Download VBA Code

 

If the above code is showing an error then try this alternative code

One of my subscribers told me that he applied the above code on his data to split all sheets into Separate files, but it is showing an error “ws.Copy” VBA run-time error 1004 we couldn't copy this sheet VBA run-time error 1004 we couldn't copy this sheet debug error ws.copy Try this VBA Code

Sub SplitAllWorksheet()
    Dim FPath As String
    FPath = Application.ActiveWorkbook.Path
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    
    Dim ws As Worksheet
    Dim newWorkbook As Workbook
    For Each ws In ThisWorkbook.Sheets
        Set newWorkbook = Workbooks.Add ' Create a new workbook
        
        ' Copy data and formatting to the new workbook
        ws.Cells.Copy
        newWorkbook.Sheets(1).Range("A1").PasteSpecial xlPasteAll
        Application.CutCopyMode = False
        
        ' Save and close the new workbook with the sheet's name
        newWorkbook.SaveAs Filename:=FPath & "\" & ws.Name & ".xlsx"
        newWorkbook.Close False
    Next ws
    
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
End Sub

Download VBA Code

 

Join Our Telegram Group techguruplus telegram group Join Our WhatsApp Group techguruplus whatsapp group
Nazim Khan - Author Image

Nazim Khan (Author) 📞 +91 9536250020
[MBA in Finance]

Nazim Khan is an expert in Microsoft Excel. He teaches people how to use it better. He has been doing this for more than ten years. He is running this website (TechGuruPlus.com) and a YouTube channel called "Business Excel" since 2016. He shares useful tips from his own experiences to help others improve their Excel skills and careers.

3 thoughts on “How to Split Each Excel Sheet Into a Separate File by One Click”

  1. I want 10 excel sheet should be split out of 50 excel sheet from a excel work book. Another I have 30 excel work book of different data (not match each other) and each having 5 to 6 excel sheet now i want to create one Master excel work book of having 30 sheet from 30 excel work book which contain specific sheet (Not match each other) from 30 work book.

    Reply

Leave a Comment