Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Nested formula to search a text string and return specific text | Excel Worksheet Functions | |||
What function do I use to return a certain value for specific text | Excel Discussion (Misc queries) | |||
Select cell containing specific text &return value from another ce | Excel Worksheet Functions | |||
can you find specific text in a string ignoring any other text | Excel Discussion (Misc queries) | |||
How to find a specific inform with some cells and return total | Excel Programming |