I need your help! I have multiple excel files in one directory that I need to copy into one master excel file and copy each incoming file into a separate tab (and putting file name on tab) in the master excel file. I do have the below VBA macro but it really doesn't work correctly. It seems to randomly make duplicate copies of some files and doesn't put name on the tab correctly on some files as well. Its not a reliable script. Can someone please help! I would appreciate it very much! Thanks in advance for looking at this for me. Phil
Sub Copyfiles()
Path = "C:\Users\Phil\Desktop\Matrices - Access\"
Filename = Dir(Path & "*.xls")
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
Sub Copyfiles()
Path = "C:\Users\Phil\Desktop\Matrices - Access\"
Filename = Dir(Path & "*.xls")
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