PDA

View Full Version : Solved: Vlookuping a separate sheet



Asterix
04-03-2008, 03:42 AM
Dear all,
Before, I had 2 sheets in 1 workbook, "A" and "B". The following code worked when run from "A" (Range("N") is in "A")...

If Range("N").Cells(c.Row, 1).Value = "" Then Range("N").Cells(c.Row, 1).Value = Application.WorksheetFunction.VLookup(c.Value, Sheets("B").Range("B:E"), 4, False)
But I had to split those 2 sheets into 2 workbooks, "T" and "W" ("T" holding sheet "A" and "W" holding sheet "B"). The following (amended) code is now not working when run from "T" due to a "Unable to get the VLookup property of the WorksheetFunction class" error...

If Range("N").Cells(c.Row, 1).Value = "" Then Range("N").Cells(c.Row, 1).Value = Application.WorksheetFunction.VLookup(c.Value, Workbooks("W.xls").Worksheets("B").Range("B:E"), 4, False)
Where am I going wrong?
Peter

Asterix
04-09-2008, 01:49 AM
Anyone?:thumb

Aussiebear
04-09-2008, 02:03 AM
Care to post your workbook, just in case we need to translate what you think you said, to that which we thought you said...

rory
04-09-2008, 05:55 AM
There's nothing syntactically wrong with the code so:
Is the value in C definitely found in column B on the B sheet in W.xls? (I suspect not)

Asterix
04-11-2008, 04:47 AM
There's nothing syntactically wrong with the code so:
Is the value in C definitely found in column B on the B sheet in W.xls? (I suspect not)

:thumb :bow: :beerchug: :whistle: :whistle: :doh: :yes