I want a script that pulls 3 different worksheets from another workbook and just stack the data in a new blank sheet.
This seems like it should work but it's not:
Sub CombineSheets()
Set NewSheet = Worksheets("Sheet2")
Set MC = Workbooks.Open("S:\OtherWorkBook.xlsm")
Set T1 = MC.Worksheets("T1")
Set T2 = MC.Worksheets("T2")
Set T3 = MC.Worksheets("T3")
With T1
lastrow = .Range("A" & .Rows.Count).End(xlUp).Row
.Range("A5:I" & lastrow).Copy NewSheet.Range("A" & wks.Rows.Count).End(xlUp)
End With
With T2
lastrow = .Range("A" & .Rows.Count).End(xlUp).Row
.Range("A5:I" & lastrow).Copy NewSheet.Range("A" & wks.Rows.Count).End(xlUp)
End With
With T3
lastrow = .Range("A" & .Rows.Count).End(xlUp).Row
.Range("A5:I" & lastrow).Copy NewSheet.Range("A" & wks.Rows.Count).End(xlUp)
End With
Workbooks("OtherWorkBook.xlsm").Close SaveChanges:=False
End Sub
The script runs but nothing is dumped into NewSheet? What am I missing. Thank you!