Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Matrix lookup/mulitple criteria lookup | Excel Discussion (Misc queries) | |||
Get Cell Address From Lookup (Alternative to Lookup) | Excel Worksheet Functions | |||
Join 2 Lists - Lookup value in 1 list & use result in 2nd lookup | Excel Worksheet Functions | |||
Sumproduct - Condition based on lookup of a Lookup | Excel Discussion (Misc queries) | |||
Pivot table doing a lookup without using the lookup function? | Excel Discussion (Misc queries) |