VLookup error message while accessing range in closed workbook.

  • Thread starter Thread starter Peter McNaughton
  • Start date Start date
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)
 
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)
.
 
Back
Top