Forum Discussion

kimpy318's avatar
kimpy318
Copper Contributor
Jun 07, 2023
Solved

Absolute Referencing in a VLookup in VBA

Hello!   I am trying to write a macro that does a vlookup into a range of cells from another sheet in my workbook , but I do not know how to make that range of cells constant when I apply the vlook...
  • HansVogelaar's avatar
    HansVogelaar
    Jun 08, 2023

    kimpy318 

    OK, you can use

     

    ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-5], 'To Format'!R2C1:R" & lastRow & "C20, 10, FALSE)"

Resources