Instructions to merge multiple Excel files into 1 File
The following article details how to combine multiple Excel files into a single file.
For example, there are 2 data files as follows:
File 1 named DS_1 has the content:
File 2 named DS_2 has the content:
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 .
Step 2: Copy the whole code into Module 1 .
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 .
Step 4: Create 1 more Module, click Insert -> Module .
Step 5: Copy the whole code into module 2 -> save and name GopCacSheet () .
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 .
Step 7: Macro dialog box appears -> select module 1 (name GopFileExcel ()) -> Run .
Step 8: The Browse dialog box appears, select the path to the data files to merge (here files DS_1 and DS_2) -> Open .
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 .
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:
Attention:
- 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.
Good luck!
You should read it
- Merge keyboard shortcuts in Excel
- How to split, merge first name in Excel
- How to merge cells in Excel - Instructions to merge cells in Excel 2010, 2013, 2016
- Instructions to merge multiple PDF files into one PDF file
- How to merge multiple PDF files into one PDF file in Mac OS X
- How to merge multiple Word files into 1 file, merge multiple Word documents into one
- How to merge cells in Excel 2003 2007
- Mix text, merge messages, mix Excel tables into Word 2007 documents
May be interested
- Tips to fix errors when multiple Excel files are grouped together in one quick tabinstructions on how to fix errors when multiple excel files are grouped together in one tab, super easy. how to merge multiple files without errors using power query.
- Tips for merging multiple PDF files into one simplest filehello! today's tipsmake will reveal the secret to merging multiple pdf files into one simple file. if you need this trick, learn it now!
- 5 nightmares for Excel and how to fix itwe will show you how to handle multiple workbooks effectively, speed up heavy files, track changes from multiple users, find the required features in a multitude of ribbons and import data one by one. easy way.
- How to split sheet into multiple separate Excel filesdo you want to split sheets in an excel file into multiple separate files? see instructions from free download for easy manipulation.
- How to Merge AVI Filesavi (audio video interleave) is a multimedia file format used to create and play back movies. you can merge avi files to join multiple short clips and create 1 final full-length video. there are many programs that allow you to join avi...
- How to merge cells in Excel - Instructions to merge cells in Excel 2010, 2013, 2016how to merge cells in excel - instructions to merge cells in excel 2010, 2013, 2016. while working with excel, sometimes you want to combine cells together to make the cell larger in size and better suited to the content. than. but you do not know how to combine cells in exc
- How to join PDF files simply and quicklymerge pdf files or merge pdf files together to help you manage small pdf files more easily or save time when having to send multiple files to others. there are many ways to join multiple pdf files together. tipsmake.com will guide
- How to put multiple photos into a PDF file on Windows 10suppose you want to share multiple photos with friends. if you want to convert multiple image files to pdf, they can view and download all images in one go, this is the way.
- Merge keyboard shortcuts in Excelmerge keyboard shortcuts in excel. anyone who uses excel knows the merge tool to mix adjacent cells together into one cell. however, not all users are proficient in using the merger shortcut to save time. today dexterity software will introduce you to read some keyboard shortcuts to merge in excel.
- How to merge multiple messages on 1 page from an Excel table in Word 2016the following article shows you how to merge multiple messages on a single page from an excel table in word 2016 to help you create invitations, certificates ... quickly and accurately.