December 5, 2016
How to modify following script to suit change the
Sub replace()
What = InputBox("Word to search")
repl = InputBox("Word to replace")
Sheets().Select
Selection.replace What:=What, Replacement:=repl, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub
My Request : I want to change and replace
e.g.In cell A1
=B5*6 changed to =B5*4
In cell A2
=B6*6 changed to =B6*4
and so on ie operator change from *6 to *4 etc etc
but seems can not use Find and Replace function for formula change to attan the desired result
Trusted Members
Moderators
November 1, 2018
You'll need to handle the * wildcard by replacing it with ~* like this:
Sub replaceText()
What = replace(InputBox("Word to search"), "*", "~*")
repl = InputBox("Word to replace")
Sheets().Select
Selection.replace What:=What, Replacement:=repl, LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False
End Sub
Trusted Members
Moderators
November 1, 2018