Range.Replace(Object, Object, Object, Object, Object, Object, Object, Object) Range.Replace(Object, Object, Object, Object, Object, Object, Object, Object) Method

Definition

Returns a Boolean indicating characters in cells within the specified range.

public bool Replace (object What, object Replacement, object LookAt, object SearchOrder, object MatchCase, object MatchByte, object SearchFormat, object ReplaceFormat);
Public Function Replace (What As Object, Replacement As Object, Optional LookAt As Object, Optional SearchOrder As Object, Optional MatchCase As Object, Optional MatchByte As Object, Optional SearchFormat As Object, Optional ReplaceFormat As Object) As Boolean

Parameters

What
Object Object

Required Object. The string you want Microsoft Excel to search for.

Replacement
Object Object

Required Object. The replacement string.

LookAt
Object Object

Optional Object. Can be one of the following XlLookAt constants: xlWhole or xlPart.

SearchOrder
Object Object

Optional Object. Can be one of the following XlSearchOrder constants: xlByRows or xlByColumns.

MatchCase
Object Object

Optional Object. True to make the search case sensitive.

MatchByte
Object Object

Optional Object. You can use this argument only if you’ve selected or installed double-byte language support in Microsoft Excel. True to have double-byte characters match only double-byte characters; False to have double-byte characters match their single-byte equivalents.

SearchFormat
Object Object

Optional Object. The search format for the method.

ReplaceFormat
Object Object

Optional Object. The replace format for the method.

Returns

Remarks

Using this method doesn’t change either the selection or the active cell.

The settings for LookAt, SearchOrder, MatchCase, and MatchByte are saved each time you use this method. If you don’t specify values for these arguments the next time you call the method, the saved values are used. Setting these arguments 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 arguments. To avoid problems, set these arguments explicitly each time you use this method.

Applies to