Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

How to Merge Multiple Excel Files Into 1 File

Learn how to Merge Multiple Excel Files Into with clear steps, useful examples, and practical tips. Complete the task correctly and avoid common mistakes.

Table of Contents

This updated guide explains how to Merge Multiple Excel Files Into 1 File through clear steps, practical examples, and important checks that help prevent common errors.

For example, there are 2 data files as follows:

File 1 named DS_1 has the content:

Merge Multiple Excel Files Into 1 File example screenshot 1

File 2 named DS_2 has the content:

Merge Multiple Excel Files Into 1 File example screenshot 2

Want to aggregate the data from the two files into a single data file named Book1 (the records are on the same Sheet) you do the following:

Step 1: Create a new Excel file named Book1 -> press Alt + F11 -> window appears -> Click the Insert tab -> Module .

Merge Multiple Excel Files Into 1 File example screenshot 3

Step 2: Copy the whole code into Module 1 .

Merge Multiple Excel Files Into 1 File example screenshot 4

Sub GopFileExcel () Dim FilesToOpen Dim x As Integer On Error GoTo ErrHandler Application.ScreenUpdating = False FilesToOpen = Application.GetOpenFilename _ (FileFilter: = "Microsoft Excel Files (* .xlsx), * .xlsx", MultiSelect: = True, Title : = "Files to Merge") If TypeName (FilesToOpen) = "Boolean" Then MsgBox "No Files were selected" GoTo ExitHandler End If x = 1 While x <= UBound (FilesToOpen) Workbooks.Open Filename: = FilesToOpen (x) Sheets (). Move After: = ThisWorkbook.Sheets (ThisWorkbook.Sheets.Count) x = x + 1 Wend ExitHandler: Application.ScreenUpdating = True Exit Sub ErrHandler: MsgBox Err.Description Resume ExitHandler End Sub 

Step 3: Save Module 1 named GopFileExcel () . Because the module contains macros, when you have a warning, click OK .

Merge Multiple Excel Files Into 1 File example screenshot 5

Step 4: Create 1 more Module, click Insert -> Module .

Merge Multiple Excel Files Into 1 File example screenshot 6

Step 5: Copy the whole code into module 2 -> save and name GopCacSheet () .

Merge Multiple Excel Files Into 1 File example screenshot 7

Sub GopCacSheet () Dim Sh As Worksheet Application.ScreenUpdating = False [A6]. CurrentRegion.Offset (1, 1) .ClearContents For Each Sh In Worksheets If Sh.Name <> "Gop_File" Then With [B65500] .End (xlUp ) .Offset (1) [A6] .CurrentRegion.Offset (1, 1). Copied Destination: =. Offset (0) End With End If Next Sh Application.ScreenUpdating = True Columns ("E: E"). Hidden = False: Randomize [A5] .Resize (, 6) .Interior.ColorIndex = 34 + 9 * Rnd () 1 End Sub 

Step 6: Go back to the newly created Excel File -> Go to View tab -> View Marco .

Merge Multiple Excel Files Into 1 File example screenshot 8

Step 7: Macro dialog box appears -> select module 1 (name GopFileExcel ()) -> Run .

Merge Multiple Excel Files Into 1 File example screenshot 9

Step 8: The Browse dialog box appears, select the path to the data files to merge (here files DS_1 and DS_2) -> Open .

Merge Multiple Excel Files Into 1 File example screenshot 10

After selecting Open data from 2 corresponding files recorded in sheet 2 and sheet 3 in Book1 file. The final merging of the Sheet into 1 single Sheet.

Step 9: Go to the View tab -> View Macro -> GopCacSheet () -> Run .

Merge Multiple Excel Files Into 1 File example screenshot 11

All data in 2 Sheet combined into Sheet 1. Note about the incorrect order you need to enter and align the size of the columns. After editing the results:

Merge Multiple Excel Files Into 1 File example screenshot 12

Important Notes

- Sheet merge sheet2, sheet 3 is sheet 1.

- Apply with a number of different files, the bigger the number of files, the slower the processing speed.

- In the process of merging data files should not use any data function will cause errors (because the address changes). Should use pure input.

FAQ

What is the easiest way to Merge Multiple Excel Files Into 1 File?

Start with the requirements in this guide, then follow each step in order. Check the result after every major change so problems are easier to identify.

Can beginners follow these instructions?

Yes. The process is organized into practical steps, and you can repeat any step before moving forward.

What should I check if the method does not work?

Confirm your software or device version, permissions, settings, file format, and internet connection when the task depends on online services.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.