I have a macro to combine different workbooks into one master Excel workbook:
Sub GetSheets()
Path = "\Users\myname\Documenten\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
How would I include only the first worksheet of each workbook into the master workbook?
How would I rename the worksheets to the name of the workbook it comes from?
.Worksheets(4).Copy After:=ThisWorkbook.Sheets(1)
after.Worksheets(1).Copy After:=ThisWorkbook.Sheets(1)
, and also remove theThisWorkbook.Sheets(2).name = .name
line. – YowE3K