![]() |
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 |
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 |
All times are GMT +1. The time now is 07:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com