ThrottleWorks
Excel Ninja
Hi,
I am replacing part of string from a text value.
When I replace string, I lose text formatting. How do I avoid this.
For example,
Input - > You know what, car driving is awesome (awesome word is in red font and bold type).
When I replace ‘car driving’ with ‘bike riding’ I lose text formatting.
Output - > You know what, bike riding is awesome.
I am using below mentioned code to replace string.
Range("B7:B9").Select
Selection.Replace What:="Jul", Replacement:=MyMonthName, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
I want to preserve formatting. Can anyone please help in this.
I am replacing part of string from a text value.
When I replace string, I lose text formatting. How do I avoid this.
For example,
Input - > You know what, car driving is awesome (awesome word is in red font and bold type).
When I replace ‘car driving’ with ‘bike riding’ I lose text formatting.
Output - > You know what, bike riding is awesome.
I am using below mentioned code to replace string.
Range("B7:B9").Select
Selection.Replace What:="Jul", Replacement:=MyMonthName, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
I want to preserve formatting. Can anyone please help in this.