Thread: *.Find()
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default *.Find()

You declared aax and bbx as Strings... Strings do not have properties or
methods, so you can't use aax.Find or bbx.Text. Since they are Strings, you
will have to use String functions on them. Try it this way...

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

--
Rick (MVP - Excel)


"FARAZ QURESHI" wrote in message
...
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