VBA Absolute Cell Reference

Benzoli7

Board Regular
Joined
Jan 11, 2010
Messages
136
How can I make this vlookup use absolute cell references?

HTML:
"=VLOOKUP(RC[-1],LOOKUP!R[1]C[-18]:R[113]C[-17],2)"

Thanks for your help.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Paste the formula into a cell on your worksheet.
Select the cell.
Hit F2 to get into Edit mode.
Hit F4 to change to Absolute Reference.
 
Upvote 0
Hmm. Didn't work. Is there a line of code that I can add to that to make the reference absolute? I would like to change it to this format: A1:B2 but, it didn't work when I did that. Any suggestions? Thanks for your reply.
 
Upvote 0
Sounds like you are talking about R1C1 reference style rather than Absolute Reference.

To change out of R1C1 style:
Click on the "Office Button"
Choose "Excel Options" at the bottom of the menu.
Click "Formulas"
In the "Working with formulas" section, uncheck "R1C1 reference style".
 
Upvote 0
Just checked for R1C1 formatting and the box was already unchecked. I do want to change out of this style of formatting if possible. If not, no big deal. I do however, need to make these references absolute because the current formula shifts the vlookup table down one row for everyrow that it is autofilled into. Example: Cell A1 can vlookup into range C1:D10 then cell A2 can vlookup into range C2:D11. I need A2 to have the ability to vlookup into A1. I hope that makes sense. If not, let me know and I will try to explain better. Thanks again for your help.

Range("W2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-1],LOOKUP!R[1]C[-18]:R[113]C[-17],2)"
'Dim LR As Integer
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("W2").AutoFill Destination:=Range("W2:W" & LR), Type:=xlFillDefault
Calculate
 
Upvote 0
The Formula you listed in your code above would be as follows in "A1" Style:
Code:
=VLOOKUP(V2,LOOKUP!E1:F115,2)
If you want the Lookup Table to be Absolute beginning at Row 1, then it would read:
Code:
=VLOOKUP(V2,LOOKUP!$E$1:$F$115,2)
That would translate to this in R1C1 Style:
Code:
=VLOOKUP(RC[-1],LOOKUP!R1C5:R115C6,2)
Hope this is what you are after.
 
Upvote 0

Forum statistics

Threads
1,224,513
Messages
6,179,214
Members
452,895
Latest member
BILLING GUY

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