NamedRange::FindNext Method (Object^)
Continues a search that was begun with the Find method.
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Parameters
- After
-
Type:
System::Object^
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 NamedRange control. Remember that the search begins after this cell; the specified cell is not searched until the method wraps back around to this cell. If this argument is not specified, the search starts after the cell in the upper-left corner of the NamedRange control.
Return Value
Type: Microsoft.Office.Interop.Excel::Range^A Microsoft.Office.Interop.Excel::Range object that represents a cell containing the specified information.
Finds the next cell that matches the same conditions as the Find method.
This method does not affect the selection or the active cell.
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.
For information on optional parameters, see Optional Parameters in Office Solutions.
The following code example uses the Find method to find the first cell with the value Seashell in a NamedRange control. The example then uses the FindNext and FindPrevious methods to find the next cell with the value Seashell and then return to the original cell. Finally, the example uses the Cut method to cut the contents of the first cell with the value Seashell and paste it into cell B1.
This example is for a document-level customization.