Thread: *.Find()
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default *.Find()

Find is worksheetfunction..Try with INSTR() as below

A1 = Faraz
=fndtxt(A1,"x")

Function FndTxt(aax As String, bbx As String) As String
FndTxt = "Not found"
If InStr(1, aax, bbx, vbTextCompare) 0 Then FndTxt = "Found"
End Function

--
If this post helps click Yes
---------------
Jacob Skaria


"FARAZ QURESHI" wrote:

I am trying to design a UDF to return "Found" if a piece of string is present
in a text, either manually inserted or by a cell address. What's wrong with
the following code:

Function FndTxt(aax As String, bbx As String) ', bbx As String)
If aax.Text = aax.Find(bbx.Text, , , , , , True).Text Then
FndTxt = "Found"
Else
FndTxt = "Not Found"
End If
End Function