I am trying to create a code that auto-fills based on last info filled in in column B, (The question, Sometimes there may only be one line and that causes an error in the auto-fill destination. What kind of code would you recommend, I assume and IF function...) Any suggestions would be greatly appreciated.
Dim Last As Long
Last = Range("B" & Rows.Count).End(xlUp).Row
Range("J3").FormulaR1C1 = _
"=IF(OR(ISERROR(VLOOKUP(RC[-9],Sheet1!R1C1:R1000C52,2,FALSE)),ISBLANK(VLOOKUP(RC[-9],Sheet1!R1C1:R1000C52,2,FALSE))),"""",VLOOKUP(RC[-9],Sheet1!R1C1:R1000C52,2,FALSE))"
Range("J3").AutoFill Destination:=Range("J3:J" & Last)
Dim Last As Long
Last = Range("B" & Rows.Count).End(xlUp).Row
Range("J3").FormulaR1C1 = _
"=IF(OR(ISERROR(VLOOKUP(RC[-9],Sheet1!R1C1:R1000C52,2,FALSE)),ISBLANK(VLOOKUP(RC[-9],Sheet1!R1C1:R1000C52,2,FALSE))),"""",VLOOKUP(RC[-9],Sheet1!R1C1:R1000C52,2,FALSE))"
Range("J3").AutoFill Destination:=Range("J3:J" & Last)