Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Find specific text and return coordinates

Booner, this line of code searches every cell on the Active worksheet to
find the string or text variable that was pass to this function, using the
Find method (see vba help). If the Find method finds the string variable in
one of the active worksheet cells, it set the range variable of 'frng' to
range location where the string was found. If the string was not found, then
range variable of 'frng' is set to 'Nothing'. The next line of code checks
to set if 'frng' was set to 'Nothing' (not found), if not then the string
was found. Since I I found the string location, I now have the address of
that location. Now using the 'Offset method I can now the find the address
the cell one row below it. As you requested in your macro. The FindStr()
function returns the absolute address, in the (A1) addressing format.
(See vba help on Address Method). I hope this explain what you were looking
for. Post back if more questions.

enjoy , Rick



"BOONER" wrote in message
...
What does this line do?


Set frng = Cells.Find(what:=FindMe, LookIn:=xlFormulas)


"Rick Hansen" wrote:

Good Morning Booner-- Here try this code and see if what your looking

for.
Post me back if you have questions.
enjoy, Rick (Fbks, Alaska)

Option Explicit

Function FindStr(FindMe As String) As String
Dim frng As Range

Set frng = Cells.Find(what:=FindMe, LookIn:=xlFormulas)
If Not frng Is Nothing Then
FindStr = frng.Offset(1, 0).Address(1, 1, xlA1)
Else
MsgBox ("Me, not found")
End If
End Function

Sub testIt()

Debug.Print FindStr("Me")
End Sub




"BOONER" wrote in message
...
I need a macro that will find a cell containing given text (in one
workbook),and then return the cooridinates (column and row) of the

cell
below
it, to be used in a formula in another workbook.






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
Nested formula to search a text string and return specific text Barbie Excel Worksheet Functions 10 February 21st 09 07:40 AM
What function do I use to return a certain value for specific text marjoryann Excel Discussion (Misc queries) 4 June 30th 06 12:00 AM
Select cell containing specific text &return value from another ce plf100 Excel Worksheet Functions 4 November 16th 05 01:57 PM
can you find specific text in a string ignoring any other text chriscp Excel Discussion (Misc queries) 1 September 18th 05 09:54 PM
How to find a specific inform with some cells and return total sean Excel Programming 0 January 16th 04 04:44 PM


All times are GMT +1. The time now is 09:36 AM.

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

About Us

"It's about Microsoft Excel"