Reputation: 21
I am doing a vlookup in cell J1 of Sheet2 on a table in Sheet1. After that, I want to extend the formula down to the last row of column J in Sheet2. I'm having trouble with the AutoFill part on column J. Also, I'm using another LastRow statement for the vlookup in Sheet1.
Here's what I have (starting on Sheet1):
*SOME OTHER CODE*
LASTROW = Range("A" & Rows.Count).End(xlUp).Row
Sheets("Sheet2").Select
LASTROW2 = Range("A" & Rows.Count).End(xlUp).Row
ActiveWindow.SmallScroll Down:=-51
Range("J1").Select
Application.CutCopyMode = False
ActiveCell.FormulaLocal = "=VLOOKUP(F1,Sheet1!$F$2:$G$" & LASTROW & ",2,false)"
Selection.AutoFill Destination:=Range("J2:J" & LASTROW2)
Thanks for your help!
Upvotes: 2
Views: 1681
Reputation: 13374
Maybe your Destination should include the starting cell J1:
Selection.AutoFill Destination:=Range("J1:J" & LASTROW2)
Upvotes: 1