Find + FindNext

  • Thread starter Thread starter Benoit
  • Start date Start date
B

Benoit

Hello,

I currently use the following macro:

Cells.Find(What:="testbed", After:=ActiveCell,
LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=False).Activate
Selection.ClearContents


If I wanna tell the macro to continue searching until it
doesn't find anythin anymore, what do I need to do???

Thanks!!!
 
Benoit,

If you lookup Find in VBA Help, it includes an example that also does
FindNext.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
I allready did that!!! It didn't help much!!!

I know I must use:

Cells.FindNext(???)

It's the ??? i don't know what to do with...

Thanks!!!
 
The findnext(c) is looking AGAIN for the same thing it looked for the first
time. So,if it is looking 2 it will keep looking until there are no more
2'sWith Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
 
Back
Top