Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default <<<<excel and VB lookup

I am using Excel 2003 and Visual Basic 6.3

VLOOKUP works fine in a worksheet but I am having trouble when I try to
invoke it in VB.

My code is

head = VLookup(code, "\icodes", 2)

Where code is a VB variable and "\icodes" is a named range on a worksheet.

I get the error message Function not defined.
--
Tenerife Alan
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default <<<<excel and VB lookup

Have you tried

head = Worksheetfunction.VLookup(code, "\icodes", 2)

--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Tenerife Alan" wrote:

I am using Excel 2003 and Visual Basic 6.3

VLOOKUP works fine in a worksheet but I am having trouble when I try to
invoke it in VB.

My code is

head = VLookup(code, "\icodes", 2)

Where code is a VB variable and "\icodes" is a named range on a worksheet.

I get the error message Function not defined.
--
Tenerife Alan

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default <<<<excel and VB lookup

In VBA, I'd use:

Dim res as variant 'it could be an error
dim myVal as long 'double, string ????
dim LookUpRng as range

set lookuprng = worksheets("Sheet2").range("a:b")

myval = 21234

res = application.vlookup(myval, lookuprng, 2, false)

if iserror(res) then
msgbox "not found" 'like #n/a error
else
msgbox res
end if



Tenerife Alan wrote:

I am using Excel 2003 and Visual Basic 6.3

VLOOKUP works fine in a worksheet but I am having trouble when I try to
invoke it in VB.

My code is

head = VLookup(code, "\icodes", 2)

Where code is a VB variable and "\icodes" is a named range on a worksheet.

I get the error message Function not defined.
--
Tenerife Alan


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Matrix lookup/mulitple criteria lookup MarkFranklin Excel Discussion (Misc queries) 3 March 31st 08 10:15 AM
Get Cell Address From Lookup (Alternative to Lookup) ryguy7272 Excel Worksheet Functions 12 September 28th 07 10:36 PM
Join 2 Lists - Lookup value in 1 list & use result in 2nd lookup JBush Excel Worksheet Functions 3 January 3rd 07 11:14 PM
Sumproduct - Condition based on lookup of a Lookup Hari Excel Discussion (Misc queries) 12 May 31st 06 09:28 AM
Pivot table doing a lookup without using the lookup function? NGASGELI Excel Discussion (Misc queries) 0 August 2nd 05 05:08 AM


All times are GMT +1. The time now is 06:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"