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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,214,824
Messages
6,121,784
Members
449,049
Latest member
greyangel23

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