0% found this document useful (0 votes)
9 views

Syntax: Expression Expression

The Range.FindNext method continues a search started with the Find method, finding and returning the next cell matching the specified conditions without affecting the selection or active cell. It searches for matches after an optional After cell parameter, wrapping around to the beginning of the range if it reaches the end. An example uses FindNext in a Do loop to change all cells containing 2 to 5 in a range.

Uploaded by

tranhungdao12a3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Syntax: Expression Expression

The Range.FindNext method continues a search started with the Find method, finding and returning the next cell matching the specified conditions without affecting the selection or active cell. It searches for matches after an optional After cell parameter, wrapping around to the beginning of the range if it reaches the end. An example uses FindNext in a Do loop to change all cells containing 2 to 5 in a range.

Uploaded by

tranhungdao12a3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Range.

FindNext Method
Continues a search that was begun with the Find method. Finds the next cell that matches those same
conditions and returns a Range object that represents that cell. Doesnt affect the selection or the active cell.
Syntax
expression.FindNext(After)
expression A variable that represents a Range object.
Parameters
Name Required/Optional
Data
Type
Description
After Optional Variant
The cell after which you want to search. This corresponds to the position of
the active cell when a search is done from the user interface. Note that After
must be a single cell in the range. Remember that the search begins after
this cell; the specified cell isnt searched until the method wraps back around
to this cell. If this argument isnt specified, the search starts after the cell in
the upper-left corner of the range.
Return Value
Range
Remarks
When the search reaches the end of the specified search range, it wraps around to the beginning of the range.
To stop a search when this wraparound occurs, save the address of the first found cell, and then test each
successive found-cell address against this saved address.
Example
This example finds all cells in the range A1:A500 that contain the value 2 and changes their values to 5.
Visual Basic for Applications
With 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

You might also like