Table of Contents
How to Merge Multiple Excel Files into a Single File: A Step-by-Step Guide
Go to the link to copy the code which is showing in the above video.
Sub GetSheets()
Path = "\"
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
Copy and Paste this data to practice
Excel File 1: Sheet 1- Data
| Serial No | First Name | Last Name |
| 1 | Rumman | Ansari |
| 3 | Inzamamul | Hoque |
Excel File 2: Sheet 1- Data
| Serial No | First Name | Last Name | age |
| 1 | Rumman | Ansari | 25 |
| 2 | Inzamamul | Hoque | 26 |