The Range.Find method is basically used to find specific information within a range. It has various types of attributes that can be used depending on the required values. It will return a Range object that represents the first cell where the information is found.
expression A variable that represents a Range object.
The data to search for. Can be a string or any Microsoft Excel data type.
The cell after which you want the search to begin. This corresponds to the position of the active cell when a search is done from the user interface. Notice that After must be a single cell in the range. Remember that the search begins after this cell; the specified cell isn?t searched until the method wraps back around to this cell. If you do no specify this argument, the search starts after the cell in the upper-left corner of the range.
Can be one of the following XlFindLookIn constants: xlFormulas, xlValues, or xlNotes.
Can be one of the following XlLookAt constants: xlWhole or xlPart.
Can be one of the following XlSearchOrder constants: xlByRows or xlByColumns.
True to make the search case sensitive. The default value is False.
Used only if you have selected or installed double-byte language support. True to have double-byte characters match only double-byte characters. False to have double-byte characters match their single-byte equivalents.
The search format.
The Find method returns Nothing if there is no match found. It does not affect the selection or the active cell.
The settings for LookIn, LookAt, SearchOrder, and MatchByte are saved each time you use the Find method. If you do not specify values for these parameters the next time you call the method, the saved values are used. Setting these parameters changes the settings in the Find dialog box; and changing the settings in the Find dialog box changes the saved values that are used if you omit the parameters. To avoid problems, set these parameters explicitly whenever you use this method.
When the search reaches the end of the specified 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.
This example finds all cells in the range B1:B20 on worksheet one that contain the value “Reviewed" and changes them to “Accepted".
Set c = .Find("Reviewed", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
c.Value = "Accepted"
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress