LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Find text String and select cell address where it is found?

In this partial code below I first see what the text is in cell B23 and then
find the matching text in Row 1. I can find the text ok, and its address (in
$C$R value) in row 1, but I don't know how to use that info to select that
cell so that I can use an offset statement to paste values into a Range. I
guess I don't know how to convert the info I have into a Range() expression
so that I can select the cell.

Any solution will be much appreciated



Sub TrySearchMonth(month)

Dim mySearch as Range

' TrySearchMonth Macro
' Macro recorded 4/14/2006 by John C. Flynn
'
Dim userMonth As Range

Set userMonth = Range("B23")


Set mySearch = Rows(1).Find(What:=userMonth.Value, _
After:=Cells(1), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)

Debug.Print mySearch

If mySearch = userMonth Then
Address = mySearch.Address
End If

Debug.Print Address

End Sub
 
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 cell address of last cell in a column with text mike in texas Excel Worksheet Functions 8 October 4th 08 05:41 AM
FIND / SEARCH text compare cell to string in 3rd cell nastech Excel Discussion (Misc queries) 0 October 29th 07 02:51 AM
return cell address of longest text string in a range Dave F[_2_] Excel Discussion (Misc queries) 2 July 12th 07 03:41 PM
to find the text and to know that particular cell address cheenu Excel Programming 1 March 8th 06 03:21 PM
Highlight found text string in cell? Ed[_18_] Excel Programming 4 June 4th 04 03:07 PM


All times are GMT +1. The time now is 01:57 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"