View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Kevin Vaughn Kevin Vaughn is offline
external usenet poster
 
Posts: 111
Default worksheetfunction.vlookup in vba

Worked for me. I temporarily got a #VALUE error when I tried substituting a
named range instead of using a range (a1:b4), but it turns out I had
misspelled my range (I had created it as myrante instead of myrange.) As
soon as I created the correctly named name range, it worked. I also managed
to get a #VALUE error when I changed my range to a1:a4 (as I was using 2 for
position.) Perhaps it is something like that?

--
Kevin Vaughn


"pmoon7" wrote:


Function StLookup(strSearch As String, tableName As Range, position)
StLookup = WorksheetFunction.VLOOKUP(strSearch, tableName, position,
False)

End Function

I can't seem to trace the error #value return from this function. My
original vlookup is getting wieldy -- too many ifs -- and I want to
move it within the vba function so I can organize it better.


--
pmoon7
------------------------------------------------------------------------
pmoon7's Profile: http://www.excelforum.com/member.php...o&userid=30808
View this thread: http://www.excelforum.com/showthread...hreadid=504698