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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
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,416
Messages
6,119,384
Members
448,889
Latest member
TS_711

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