Hello, new to VBA and coding in general.
I am trying to stack a group of reports into a consolidated file. Not sure why the 2nd report is not pasting under the 1st report.
Instead, it is overriding the data from the 1st report.
I assume the issue relates to Dim/Set? Still trying to understand how that works.
Any feedback would be greatly appreciated.
Thanks!
-------
Sub Report_Stack()
Dim wb As Workbook
Set wb = Workbooks.Add
With wb
.Title = "Reports Stacked"
.SaveAs Filename:="Reports Stacked"
End With
Workbooks.Open ("Z:\Report-1.xlsx")
Windows("Report-1.xlsx").Activate
Cells.Copy
Windows("Reports Stacked.xlsx").Activate
Range("A1").Select
Cells.PasteSpecial
Selection.End(xlDown).Select
ActiveCell.Offset(1).Select
Workbooks.Open ("Z:\Report-2.xlsx")
Windows("Report-2.xlsx").Activate
Cells.Copy
Windows("Reports Stacked.xlsx").Activate
Cells.PasteSpecial
Selection.End(xlDown).Select
ActiveCell.Offset(1).Select
End Sub
Bookmarks