Insert VLOOKUP into cell with VBA

17,809

as @scottCraner said, you need it in this format:

Range("B10").Select
ActiveCell.Formula = "=VLOOKUP(A10,'Sheet2'!A:B,2,0)"
Share:
17,809
reggie86
Author by

reggie86

Updated on June 04, 2022

Comments

  • reggie86
    reggie86 almost 2 years

    I cannot seem to get this to work. I want to put this vlookup formula into cell B10, looking up A10, but it gives me a NAME? value every time, as it comes out as 'A10' in the actual formula, instead of A10. Can anyone help? Here's my code:

        Range("B10").Select
        ActiveCell.FormulaR1C1 = "=VLOOKUP(A10,'Sheet2'!A:B,2,0)"