When working with multiple Microsoft Excel Files, at times, you need to merge Excel Files and Sheets to a new or existing Excel file or merge multiple excel files into one file. While you can always copy paste data from one sheet to another or from one file to another, it’s tedious when there are too many of them. In this post, we will share how you can merge them using the inbuilt function.
How to Merge Excel Files & Sheets
Before you start merging files and sheets, plan it well. While you can always rearrange sheets later, the better you plan, the less amount of hours you will spend on sorting them after merging.
- Merge Sheets to a new or existing file
- Merge Multiple Excel Files
While the functions we will use here will give you the option to move sheets, I will recommend copying. If you ever need the original file again, you will have the choice.
Merge Sheets to a new or existing file
Before we start merging, make sure you have all the Excel files open. Only when they are open, Excel merge function can choose that as a destination. If you plan to move sheets from multiple files into a new excel file, you can do that as well.
- Open the source excel file, and switch to the sheet you wish to copy
- Click on Home tab > Cells section > Format > Move or copy sheet
- It will open a popup from where you can select existing excel file or create a new file on the run
- When you choose a new file option, it will instantly create a new file but will not save it.
- When you choose an existing file, you have the option to select where the sheet will be inserted, i.e., before or after existing sheets or end of all sheets
- Make sure to select the checkbox— Create a copy. It will make sure your existing sheets remain in the sourcebook.
You can also move into an existing file, which is handy if there are too many sheets, and you need to insert the sheet in between them, somewhere, or move it to the end.
If you want to move multiple sheets to another Excel file, then before using “Move or copy sheet,” select the sheets using Ctrl or Shift. While Shift will allow you to select adjacent sheets or range of sheets, Ctrl will let you choose the individual sheets. The rest of the steps are the same. You can use this to manually merging excel files.
Merge Multiple Excel Files
Merging Excel files is a tricky thing, and for that, we will use a VBA code from ExtendOffice. It will allow you to combine multiple files or workbooks available in a folder.
- Create a new Excel spreadsheet, and press ALT + F11 to open Developer section
- Click on Insert menu, and then Module
- Paste the code mentioned below. Name the Module as MergeExcel
Sub MergeExcel() Path = "D:\ExcelFiles\" Filename = Dir(Path & "*.xlsx") Do While Filename <> "" Workbooks.Open Filename:=Path & Filename, ReadOnly:=True For Each Sheet In ActiveWorkbook.Sheets Sheet.Copy After:=ThisWorkbook.Sheets(1) Next Sheet Workbooks(Filename).Close Filename = Dir() Loop End Sub
Next, press Alt + F8 to open the Macro dialog. It will reveal all the Macros in the sheet. Select MergeExcel and click Run. You will be prompted to save files, make sure to do so. Done that, all the sheets from different excel files will become available into the excel file where you ran the Macro. ExtendOffice Website has many such macros, and I would strongly suggest to visit them at extendoffice.com.
That said, it is not going to be a smooth experience at the first try. Stay assured that it will not delete any files, but I would suggest keeping a backup of the files. Experiment with some random data, and check if you are getting the desired result using the macro.
We hope the tutorial was easy to understand, and you can merge Excel Files and Sheets.
- Tags: Excel