Keeping VLOOKUP table array fixed in VBA

bikeman

New Member
Joined
Jul 4, 2010
Messages
3
I am using VBA to run a VLOOKUP, but when it runs, the table array moves and therefore is not returning results. Below is the syntax and I am having trouble fixing the range to

..ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],RC[-7]:R[1000]C[-6],2,FALSE)"..

each time this moves down a row, the array misses entries above it in the table. Any suggestions?

Thanks
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
This is the VLOOKUP that I am trying to get working in the macro

=VLOOKUP(G2,$A$2:$B$1000,2,FALSE)

Hope that gives enough info.
 
Upvote 0
Thanks niceguy,

I've tried that had got an error, but you put me on the right track again.
I got it to work using this
"=VLOOKUP(RC[-1],R2C[-7]:R1000C[-6],2,FALSE)"

Cheers
 
Upvote 0

Forum statistics

Threads
1,214,981
Messages
6,122,565
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top