VLookup error message while accessing range in closed workbook.

P

Peter McNaughton

Hi
I am trying to access a Range in another (unopened) workbook by
creating a temporary range called "test" that I will later delete to
remove the Link. That is ok but I want to get the Price asociated
with "Angus" but get an error
"Unable to get the VLookup property of the Worksheet Function class"
The Vlookup function works if typed into the worksheet.

I would appreciate some helpful suggestions

Peter

Code follows:
ActiveWorkbook.Names.Add Name:="test", RefersTo:="='G:\[Price
List.xls]Price List'!$A$2:$B$53"
xxx = Application.WorksheetFunction.VLookup("Angus", test, 2, False)
 
A

acw

Peter

Try
xxx = Application.WorksheetFunction.VLookup("Angus", Range
("test"), 2, False)


Tony

-----Original Message-----
Hi
I am trying to access a Range in another (unopened) workbook by
creating a temporary range called "test" that I will later delete to
remove the Link. That is ok but I want to get the Price asociated
with "Angus" but get an error
"Unable to get the VLookup property of the Worksheet Function class"
The Vlookup function works if typed into the worksheet.

I would appreciate some helpful suggestions

Peter

Code follows:
ActiveWorkbook.Names.Add Name:="test", RefersTo:="='G:\[Price
List.xls]Price List'!$A$2:$B$53"
xxx = Application.WorksheetFunction.VLookup("Angus", test, 2, False)
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top