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

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
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,213,544
Messages
6,114,249
Members
448,556
Latest member
peterhess2002

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