Hello,
I'm fairly new to Excel when it comes to VBA programming and I need bit of help with some code.
I have code that combines all excel files from folder into one workbook. Each file to it's own sheet in workbook.
Folder where I have files is D:\Test\ (+subfolders D:\Test\1\, D:\Test\2\ etc.. )
Code works fine to all files what are in D:\Test\, but how can I get it, so that it also searches files from subfolders in directory D:\Test\
Many thanks in advance
Here's the code:
Sub HaeData()
Path = "D:\Test\"
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
Bookmarks