Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default function doesn't work

Hi! Can anyone spot what is wrong with the following
function. I'm trying to write a function similar to
vlookup, but which allows for more flexibility. I could
swear it was working to a degree with excelXP ("find" only
picked up one element - I thought the output would be a
set of elements), but now with excel97 it doesn't work at
all.

Function lookupvalue(valuetolookup, lookuprange,
rowoffset, columnoffset)
Set rangeofvalues = lookuprange.Find(valuetolookup)
For Each element In rangeofvalues
MsgBox (element.Address)
Next element
'Set nextvalue = lookuprange.FindNext
'If nextvalue Is Nothing Then
lookupvalue = lookuprange.Find(valuetolookup).Offset
(rowoffset, columnoffset).Value
'Else: MsgBox ("multiple output")
'End If
End Function
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default function doesn't work

Find doesn't work with UDF's in Excel 97 and Excel 2000.

--
Regards,
Tom Ogilvy

"Claude" wrote in message
...
Hi! Can anyone spot what is wrong with the following
function. I'm trying to write a function similar to
vlookup, but which allows for more flexibility. I could
swear it was working to a degree with excelXP ("find" only
picked up one element - I thought the output would be a
set of elements), but now with excel97 it doesn't work at
all.

Function lookupvalue(valuetolookup, lookuprange,
rowoffset, columnoffset)
Set rangeofvalues = lookuprange.Find(valuetolookup)
For Each element In rangeofvalues
MsgBox (element.Address)
Next element
'Set nextvalue = lookuprange.FindNext
'If nextvalue Is Nothing Then
lookupvalue = lookuprange.Find(valuetolookup).Offset
(rowoffset, columnoffset).Value
'Else: MsgBox ("multiple output")
'End If
End Function



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
Why won't this function work? Angelsnecropolis Excel Worksheet Functions 3 March 12th 10 05:00 AM
Function doesn't work Neal Carron[_2_] Excel Worksheet Functions 2 January 26th 10 02:11 AM
need a function that will work using multiple work books and sheet capt c Excel Worksheet Functions 1 March 30th 09 10:20 PM
Why does my Function not work? [email protected] Excel Discussion (Misc queries) 2 April 27th 07 10:22 PM
how do i get the mid function to work with a zero garbold Excel Worksheet Functions 7 June 7th 06 10:58 PM


All times are GMT +1. The time now is 02:41 AM.

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

About Us

"It's about Microsoft Excel"