I have used an Excel formula =TRIM(CLEAN(SUBSTITUTE(A1,CHAR(160)," "))) to trim and clean extra spaces in multiple paragraphs of text. The formula worked, but it also removed spaces (some, but not all) between the end of a sentence and the beginning of the sentence that follows. I need to add a space between sentences that no longer have a space between them.
Example: This is the first sentence with a period ending the sentence, but no space after the period.This is the beginning of the second sentence. This is the beginning of the third sentence with proper space at the beginning, but missing a space at the end.And so on...
I found a suggestion to use the following code, but not sure how to utilize in Excel VBA.
To insert a space after every dot except for the dots that already have a space or dots at the end of the string:
var newString = Regex.Replace(oldString, @".(?! |$)", ". ");
Can the above code be used in Excel VBA to resolve this issue?