Created a VBA where upon clicking refresh, data is filtered and copied from one worksheet and pasted into another. When I tried to run this, invalid outside procedure occurred.
I had used C:I because C is column where the criteria should be applied and filtered. However, I still need column B (hence the B:I) included in the pasted data in "Tracking Sheet". C is 3. But my question isn't about the range, just background that I know the range is iffy.
Sub Refresh()
Dim Worksheet1 As Worksheet
Dim lastrowtop, lastrowbottom As Integer
Worksheets("AUTOTRACK").Range("C2:I2").AutoFilter _
field:=3, _
Criteria1:=Date - 1
lastrowtop = Worksheets("AUTOTRACK").Cells(3, 2105).End(xlDown).Row
lastrowbottom = Worksheets("Tracking Sheet").Cells(3,1601).End(xlDown).Row
Range("C:I" & lastrowtop).Copy Destination:=Worksheets("Tracking
Sheet").Range("B:I" & lastrowbottom + 1)
MsgBox ("Pull is complete")
End Sub