#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default *.Find()

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

  #2   Report Post  
Posted to microsoft.public.excel.misc
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


  #3   Report Post  
Posted to microsoft.public.excel.misc
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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default *.Find()

Thanx Rick!

XClent!

"Rick Rothstein" wrote:

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find First Non blank cell than find column header and return that value Silver Rose Excel Worksheet Functions 10 April 30th 07 05:56 PM
where to put results of find operation in find and replace functio DEP Excel Worksheet Functions 5 November 15th 06 07:52 PM
Despite data existing in Excel 2002 spreadsheet Find doesn't find AnnieB Excel Discussion (Misc queries) 1 June 16th 06 02:15 AM
'find' somtimes can't find numbers. I folowd the 'help' instructi. Yaron Excel Worksheet Functions 2 November 30th 05 05:46 PM
How do I find a file/spreadsheet that Excel says is Already open but I can't find it? nwtrader8 Excel Discussion (Misc queries) 5 June 21st 05 02:16 PM


All times are GMT +1. The time now is 08:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"