Name
range.Replace(What, Replacement, [LookAt]), [SearchOrder], [MatchCase], [MatchByte], [SearchFormat], [ReplaceFormat])
Synopsis
Replaces text within the cells in the specified range.
|
Argument |
Settings |
|---|---|
|
|
The string to search for. |
|
|
The replacement string. |
|
|
|
|
|
|
|
|
False (default) ignores case; True performs a case-sensitive search. |
|
|
If double-byte language support is enabled:
|
|
|
The search format. |
|
|
The replace format. |
The following code replaces all occurrences of the string "Ichiro" in the specified range with the string "Suzuki":
Dim r As Range
Set r = ActiveSheet.Range("A1:A6")
r.Replace "Ichiro", "Suzuki"Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access