ds2020
New Member
- Joined
- Mar 15, 2020
- Messages
- 16
- Office Version
- 2019
- Platform
- Windows
this is part of my code to open multiple workbooks and put them in sheets in one workbook. However, the name (path) is not the full path (it's missing the important part of the names). What can I do to get the full name of every sheet from this code?
Path = "D:\uni\Test Data\197\New folder\"
Filename = Dir(Path)
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
Dim xsheet As Worksheet
For Each xsheet In ThisWorkbook.Worksheets
xsheet.Select
Path = "D:\uni\Test Data\197\New folder\"
Filename = Dir(Path)
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
Dim xsheet As Worksheet
For Each xsheet In ThisWorkbook.Worksheets
xsheet.Select