View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Trying to limit .Find to a specific range

Bill,

Just change
With Cells
to
With Range("A1:A10")

or whatever range you want to search.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


wrote in message
...
I am trying to find occurances of value within a range of cells.
Could someone help me with this code?

tia

For Each rngMyCell In rngMyRange
With Cells
Set rngMyCell = .Find(What:=strEdit_Find, After:=ActiveCell,_
LookIn:=xlValues, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
If Not rngMyCell Is Nothing Then
strFirstAddress = rngMyCell.Address
Do
strData = rngMyCell.Formula
lCountValueReplaces = lCountValueReplaces + 1
Set rngMyCell = .FindNext(rngMyCell)
Loop While Not rngMyCell Is Nothing And ngMyCell.Address
< strFirstAddress
End If
End With
Next