Reputation: 315
I need some help on integrating multiple workbooks into a single master workbook. I am trying to use the following macro code. Problem is that it doesn't enter the do while loop. I have verified the path too. Kindle help
Sub GetSheets()
Path = "C:\Users\ssehgal\Documents\Excel-Files-For-Macro"
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
Upvotes: 0
Views: 88
Reputation: 4974
Replace this:
Path = "C:\Users\ssehgal\Documents\Excel-Files-For-Macro"
Filename = Dir(Path & "*.xls")
with this:
Path = "C:\Users\ssehgal\Documents\Excel-Files-For-Macro\"
Filename = Dir(Path & "*.xls")
You were missing the \
Upvotes: 1