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"
Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.