VBA - Worksheet Functions...


Posted by Greg Taylor on April 23, 2001 12:35 PM

Set MyObject = GetObject("C:\My Documents\HrDatabase.xls")
MyObject.Application.Visible = True
myRange = "A1:D9999"
Index = MyObject.Application.WorksheetFunction.VLookup(Name, myRange, 2)
Form_MM.Lb_EmpIndex.Caption = Index

This is what I have. But I keep getting
"Unable to get the VLookup property of the worksheetfunction class."

What am I doing wrong? Thanks

Posted by Dax on April 23, 2001 2:23 PM

Hi,

You are passing a string variable to the Vlookup function rather than a range object. Change your range definition line to this and Dim MyRange as Range.

Set MyRange=Range("A1:D9999")



Posted by Dave Hawley on April 23, 2001 10:43 PM

Hi Greg

Dax is right!

You could also use: Range(MyRange)


Dave

OzGrid Business Applications