PDA

View Full Version : Sleeper: Find in UDF



sonu
07-05-2005, 01:26 PM
How do I use find function in UDF.

The following line does not work in a function listed below


find_val = Range("H:H").Find("abc")


Function find_val(va As Variant)
find_val = Range("H:H").Find("abc")
End Function

but when I put it in a sub procedure it works fine


sub test
find_val = Range("H:H").Find("abc")
end sub

Can someone help

Thanks.
:dunno
Sonu

Bob Phillips
07-05-2005, 04:11 PM
Find will not work in a worksheet function, just won't.

What are you trying to get? If you want to know a value is in the column, you could use


=COUNTIF(H:H,"abc")>0

Aaron Blood
07-05-2005, 04:17 PM
Sounds like you want the capability of my Find_Range UDF.

The example can be found here:
http://www.xl-logic.com/pages/vba.html

Look for: "kickbutt_find_function.zip"