Vlookup formula script

G

Gor_yee

hi all,

I've got this script

ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[2],R6C[-8]:R65536C[-2],7,1)"
ActiveCell.Copy
Range(Range("N6"), Range("N6").Offset(0, 1) _
.End(xlDown).Offset(0, -1)).Select
ActiveSheet.Paste

which is basically the forumla

=VLOOKUP(P6,F$6:L$65536,7,1)

How to I add those $ signs into the script as it does not recognise
it??Please help...thank you so much
 
D

Don Guillett

try it this way. Suggest you change your 65536 to something more realistic.

Sub doformulas()
Range(Range("N6"), Range("N6").Offset(0, 1) _
.End(xlDown).Offset(0, -1)).Formula = _
"=VLOOKUP(P6,F$6:L$65536,7,1)"
End Sub
 
Top