I have vlookup formula that takes the value of A2 and returns the corresponding match found in my Lookup_Table in cell O2, this lookup continues for the rows underneath.
How would I modify this code to lookup a range of values in A:M, with the results placed in O:AA? Or do I have to manually code each column separately?
With Sheets("Example")
.Range("O2:O" & .Range("A" & Rows.Count).End(xlUp).Row).Formula = _
"=IF(ISERROR(VLOOKUP(A2,'Lookup_Table'!A:H,4,FALSE)),0,VLOOKUP(A2,'Lookup_Table'!A:H,4,FALSE))"
.Range("O2:O" & .Range("A" & Rows.Count).End(xlUp).Row).Value = _
.Range("O2:O" & .Range("A" & Rows.Count).End(xlUp).Row).Value 'Comment out if you'd like to leave the above formula in place
End With
=IF(ISERROR(VLOOKUP(B2,Lookup_Table!B:I,4,FALSE)),0,VLOOKUP(B2,Lookup_Table!B:I,4,FALSE))
is redundant, you should be using something like=IFERROR(VLOOKUP(A2,Lookup_Table!A:H,4,FALSE),0)
– Michal Rosa