ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Vlookup formula script (https://www.excelbanter.com/excel-discussion-misc-queries/153049-vlookup-formula-script.html)

Gor_yee

Vlookup formula script
 
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


Don Guillett

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




All times are GMT +1. The time now is 03:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com