#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default VB Find

How can I do a find within a range in VB and return the cell location of
that find?

Thanks in advance for your help?

Mike


  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Tom is offline
external usenet poster
 
Posts: 44
Default VB Find

the following example returns all cells with the required value.

Tom


Sub Find()
Dim r As Range
Dim strFind As String
Dim strAddress As String

strFind = "Hello"

With ActiveSheet

Set r = .Cells.Find(strFind)
If Not r Is Nothing Then
strAddress = r.Address
Do
MsgBox r.Address
Set r = Cells.FindNext(r)
Loop While Not r Is Nothing And r.Address < strAddress
Else
MsgBox "Not found"
End If
End With
End Sub



"Michael Kintner" schrieb im Newsbeitrag
...
How can I do a find within a range in VB and return the cell location of
that find?

Thanks in advance for your help?

Mike




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VB Find

see the example code in Excel VBA help on the Find method.

or turn on the macro recorder, then do Edit=Find

--
Regards,
Tom Ogilvy

"Michael Kintner" wrote in message
...
How can I do a find within a range in VB and return the cell location of
that find?

Thanks in advance for your help?

Mike




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 04:32 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"