vlookup in VB

Sarah K

New Member
Joined
Nov 26, 2008
Messages
24
Hi there.

I'm trying to do a vlookup in Vb, I've come up with the following but it's not working (and it's not because I haven't defined the variables or anything, i just don't know the correct code for the vlookup in vb (it's clear as crystal when I'm doing one in a cell in the excel worksheet!)).
Using excel 2002.

application.vlookup(range(cells(i,2)),windows(x).sheets(y).range(E:H),2,false)

thanking you :)
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Last I checked, winders didn't have no sheets fer chillens. Sheets' parents are workbooks. And yer gonna need to put that "E:H" bit inside some quotation marks.
 
Upvote 0
Hi
I tried recording a macro, but that puts the vlookup in a cell and I want it to live in vb.
Any suggestions?
 
Upvote 0
Hey,

You want the code to be pasted until the last row of some defined column...

Is that your requirement?????
 
Upvote 0
Hi
Yes, I'm going to have to do this lots, so want the most efficient code possible. I will have a column of values in one workbook and I will need to do the vlookup for each of the column entries in a different workbook. Do vlookups actually exist in VB?? :(
 
Upvote 0
Greg,
you've got the idea of what I want...can you use my example and show me how to look up the cell value in a completely different workbook?
Thanks a million!
 
Upvote 0
Like this:
application.vlookup(range(cells(i,2)),workbook(x).sheets(y).range("E:H"),2,false)
??
Says I have a 'Compile error: expected: =
I like your parents/children thing :p
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,378
Members
448,955
Latest member
BatCoder

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