Vlookup DIM issue!

billyheanue

Board Regular
Joined
Jul 13, 2015
Messages
109
Hi all;

"Vlookprint" is the cell where the first vlookup formula will fall into. this first cell is necessary to establish because it gets resized to the correct amount of cells to do Vlookups in.

I have a cell in sheet one that contains literally, "W36". So, cell T16 = "W36". The value in cell T16 varies.
How do I store the contents of cell T16 as a variable called "vlookprint" so that the result:

vlookprint.Resize(resizeval,1).Formula....

is the same as

range("W36").resize(resizeval,1).Formula....


Heres what I have written for more reference:


Code:
Dim resizevalu As DoubleDim colindexvalu As Double
Dim vlookprint As Range   '?????
vlookprint = Sheet1.Cells(16, 20).Value '?????? I dont know what to DIM vlookprint as...a Range?
resizevalu = Sheet1.Cells(19, 12).Value
colindexvalu = Sheet1.Cells(16, 12).Value
vlookprint.Resize(resizeval, 1).Formula = "=VLOOKUP(Sheet1!B16,Sheet2!" _     'vlookprint is what I want to edit!!
    & Sheets("Sheet2").Range("A12").CurrentRegion.Address & ",Sheet1!G$13,FALSE)"



Thank you Everyone!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Do I need to change the contents of the cell from W36 to "W36".... and then do

vlookprint = Cells(16,20).Value ?

OR.... more appropriately....change W36 to Range("W36")

and then DIM as value? This seems more likely
 
Upvote 0

Forum statistics

Threads
1,215,491
Messages
6,125,101
Members
449,205
Latest member
ralemanygarcia

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