Find started working in xl2002. Before that, it didn't work in UDFs.
Are you using xl2002+?
Bernd Plumhoff wrote:
>
> Hi Niek,
>
> Find DOES work in UDF's. An example which works fine for me:
> ----- snip here --------
> Public Function holidays(ByVal s_ccy As String) As Variant
> 'Returns array of holidays for a given currency
>
> Dim rng_ccy As Range
>
> With Sheets("Holidays")
> Set rng_ccy = .Range("A2:IV2").Find(s_ccy, LookIn:=xlValues,
> LookAt:=xlWhole) 'Search for currency in row 2
> If rng_ccy Is Nothing Then
> holidays = CVErr(xlErrValue) 'Not found: return value error
> Else
> holidays = .Cells(5, rng_ccy.Column).Resize(.Cells(3,
> rng_ccy.Column), 1) 'Row 3 consists of number of holidays
> End If
> End With
>
> End Function
> ------- snip again -----------
>
> Herman, I suggest to debug your code in detail step by step...
>
> Regards,
> Bernd
> --
> Use non-volatile INDEX(P11:IV65536,1+w,1+y):INDEX(P11:IV65536,w+y,x+z)
> instead of volatile OFFSET(P11,w,x,y,z).
--
Dave Peterson
Bookmarks