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
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