VBA vlookup - dynamic sheet with last row and last column

jocker_boy

Board Regular
Joined
Feb 5, 2015
Messages
83
Hi,

I would like to add vlookup formula with VBA considering:

  • We are in "Sheet1"
  • The Table Array will be in another sheet, based on the name in cell A2 (In this case "Sheet5")
  • It will start in A1
  • The D10 is the last row and last column in "sheet5"
The goal is, if i change A2 from "Sheet5" to "Sheet10", i would like to run the macro and fill the Vlookup formula in my rows with the new table array range.

Sheet5
A=vlookup(A;'sheet5'!A1:D10;2;FALSE)
B=vlookup(B;'sheet5'!A1:D10;2;FALSE)
C=vlookup(C;'sheet5'!A1:D10;2;FALSE)

Thanks for the help.
Gonçalo
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,215,420
Messages
6,124,803
Members
449,190
Latest member
cindykay

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