6324 ... well, you probably underestimated :-) (by the way - have you used search?)
Try (it is based on a code I am using elsewhere, so some of variables have strange names :-P) in your masterfile:
Sub copy_all()
Dim my_wbk As Workbook, src_wbk As Workbook, src_wks As Worksheet
Dim ob As Object, pliki As Object, plik As Object
Dim folder As Object, mypath As String
Set my_wbk = ThisWorkbook
mypath = "C:\Users\here_your_real_path\"
Set ob = CreateObject("Scripting.FilesystemObject")
Set folder = ob.GetFolder(mypath)
Set pliki = ob.GetFolder(mypath).Files
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
For Each plik In pliki
Debug.Print plik.Name
If Right(plik.Name, 3) = "xls" Or Right(plik.Name, 4) = "xlsm" Then
Set src_wbk = Workbooks.Open(folder & "\" & plik.Name)
For Each src_wks In src_wbk.Worksheets
Debug.Print " -> " & src_wks.Name
src_wks.Copy After:=my_wbk.Sheets(my_wbk.Sheets.Count)
Next src_wks
src_wbk.Close False
End If
Next plik
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
Set my_wbk = Nothing
Set ob = Nothing
Set folder = Nothing
Set pliki = Nothing
End Sub
but note that there will be problems if sheets in different source files have the same names - of course you can rename them first - just be aware of it.
Bookmarks