RobskiV
12/4/2013 - 9:05 AM

Merge all sheets from different workbooks into one Workbook

Merge all sheets from different workbooks into one Workbook

/*
   Microsoft Visual Basic for applications window will be displayed, 
   click Insert > Module, and input the following code into the Module:
*/

Sub GetSheets()
Path = "C:\Users\dt\Desktop\test\"
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