Ever Wonder to Copy all the Workbooks into one Workbook.
In this post i will share the script to copy all the excel files from one folder to Single Excel File.
Below is the Script
Sub MergeMultipleWorkbooks()
'Define Variables
Dim Path, FileName As String
'Assign Values to Variables
Path = Assign a Folder which contains excel files for example "C:\Merge\"
FileName = Dir(Path & "*.xlsx")
'Check FileName in the Given Location
Do While FileName <> ""
'Open Excel File
Workbooks.Open FileName:=Path & FileName, ReadOnly:=True
'Copy all the sheet to this workbook
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(1)
Next Sheet
'Close the ActiveWorkbook
Workbooks(FileName).Close
'Assign a Excel FileName
'Assign Next Excel FileName
FileName = Dir()
Loop
'Display a Message
MsgBox "Files has been copied Successfull", , "MergeMultipleExcelFiles"
End Sub
In this post i will share the script to copy all the excel files from one folder to Single Excel File.
Below is the Script
Sub MergeMultipleWorkbooks()
'Define Variables
Dim Path, FileName As String
'Assign Values to Variables
Path = Assign a Folder which contains excel files for example "C:\Merge\"
FileName = Dir(Path & "*.xlsx")
'Check FileName in the Given Location
Do While FileName <> ""
'Open Excel File
Workbooks.Open FileName:=Path & FileName, ReadOnly:=True
'Copy all the sheet to this workbook
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(1)
Next Sheet
'Close the ActiveWorkbook
Workbooks(FileName).Close
'Assign a Excel FileName
'Assign Next Excel FileName
FileName = Dir()
Loop
'Display a Message
MsgBox "Files has been copied Successfull", , "MergeMultipleExcelFiles"
End Sub
See it in Action.