How to Merge Multiple Excel Files into a Single File: A Step-by-Step Guide

Rumman Ansari   Software Engineer   2024-09-04 11:29:01   903  Share
Subject Syllabus DetailsSubject Details
☰ TContent
☰Fullscreen

Table of Content:


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


Stay Ahead of the Curve! Check out these trending topics and sharpen your skills.