The Replace method replaces specified text in the worksheet.
object.Replace( TargetStr,
Parameter |
Type |
Description |
TargetStr |
String |
required; target text |
ReplaceStr |
String |
required; inserted text |
Current |
IWksRange |
required; |
Scope |
wksFindScope |
optional; specifies search scope |
Method |
wksFindMethod |
optional; specifies search method |
MatchCase |
Boolean |
optional; "true" to match case |
DelSelFirst |
Boolean |
optional; "true" |
ReplaceAll |
Boolean |
optional; "true" to replace all matching text |
OrderByRows |
Boolean |
optional; "true" searches by row order |
'Replace
'Replace any occurrences of an uppercase "A" with "alpha"
Wks.UsedRange.Replace(TargetStr:="A", ReplaceStr:="alpha", Current:=Nothing, Method:=wksFindPhrase, _
MatchCase:=True, ReplaceAll:=True)
Used by: WksRange object