View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Vlookup formula script

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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Gor_yee" wrote in message
ups.com...
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