ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.substitute (https://www.excelbanter.com/excel-programming/454452-application-substitute.html)

RG III

Application.substitute
 
I'm able to read a text file into a variable. Now I want to do a search and replace of ALL instances of the word "bitch". Using Application.substitute() I'm able to replace the first occurrence of the target string, but I want to replace ALL occurrences with "#####".

How do you get Application.substitute() to search and replace multiple instances of a target string? Or is there a better method?

-Robert

Claus Busch

Application.substitute
 
Hi Robert,

Am Sat, 28 Sep 2019 13:11:20 -0700 (PDT) schrieb RG III:

I'm able to read a text file into a variable. Now I want to do a search and replace of ALL instances of the word "bitch". Using Application.substitute() I'm able to replace the first occurrence of the target string, but I want to replace ALL occurrences with "#####".

How do you get Application.substitute() to search and replace multiple instances of a target string? Or is there a better method?


try:

myStr = Replace(myStr, "bitch", "####")


Regards
Claus B.
--
Windows10
Office 2016


All times are GMT +1. The time now is 03:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com