Forum Discussion

Lindsy's avatar
Lindsy
Copper Contributor
Oct 17, 2022

VBA to add a column with a VLOOKUP formula referencing another sheet.

Hi, The VLOOKUP works but returns #N/A for all non matches. IFERROR results in blank cells.        Dim lastRow As Long lastRow = Cells(Rows.Count, ...
  • HansVogelaar's avatar
    HansVogelaar
    Oct 17, 2022

    Lindsy 

    What is New Sheet? Table names cannot contain spaces...

    IFERROR works like this when you specify it in VBA:

                                Range("AG2:AG" & lastRow).FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-19],New_Sheet[[Name]:[Exists]],5,FALSE),"""")"

Resources