VLOOKUP & Macro

punkin0601

New Member
Joined
Aug 16, 2005
Messages
26
I am trying to write a macro with a VLOOKUP formula. I currently have:

Dim cell As Range
Cells.EntireRow.Hidden = False
Range(A15:A & Range("A65536").End(xlUp).Row).Select

For Each cell In Selection

If Left(cell.Text,1) = "1" Then Cells(cell.Row, "b") = "=VLOOKUP(
RC[-1],'VB Input'!R4C5:R824C6,4,0)"

The numbers of rows may vary each time I run the macro. How do I adjust my VLOOKUP formula to accomodate this issue.

Thank you in advance for your help!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Why not just have the lookup based on the whole column?

Replace:
'VB Input'!R4C5:R824C6
with
'VB Input'!RC5:RC6
 
Upvote 0
This is not working for me. It is not considering the whole column when I use it in my macro. Any other suggestions? I have tried searching the board for other posts and cannot find anything.
 
Upvote 0

Forum statistics

Threads
1,215,053
Messages
6,122,882
Members
449,097
Latest member
dbomb1414

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