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
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
Thanks Velourla , will have a go on that...
Tied but the macro doesn't work pls refer attached sample.
Kindly review the Macro module per attach to see if any things goes wrong, now doesn't work at all..
That's your original code, not mine. Also, as written it only works on whatever cells you have selected when you run it - was that your intention?
Thanks, understand. Macro work on selected cells.
I need to modiy if work on others cells.
Which cells specifically?
Cells at random in each worksheet.
Anyway I master the tips you so kind share, Velouria, and the small VB tools should work fine..