Hi there,

I am trying to use variables within a vlookup in vba. The code i am trying to amend is:-
Sub Macro7()

    Range("J3").Select

    ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-9],Sheet1!C[-8],1,FALSE)"

End Sub
I tried to amend as so but no luck:-

Sub Macro7()

Dim y As Integer
Dim x As Integer
y = -9
x = -8
    Range("J3").Select

    ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[y],Sheet1!C[x],1,FALSE)"


End Sub
Any help would be much appreciated.

Kind regards,

forrestgump