View Single Post
 
Old 04-04-2019, 09:50 AM
abenitez77 abenitez77 is offline Windows 10 Office 2016
Novice
 
Join Date: Apr 2019
Posts: 9
abenitez77 is on a distinguished road
Exclamation remove carriage return

Hello,
I have a spreadsheet that has cells that are formatted with "wrap text" and the value is a short 2 to 5 word title. within the title it sometimes contains a chr(10) (carriage return).

I am using this line to remove the carriage return:
Sheets(1).Cells.Replace What:=Chr(10), Replacement:=""

The problem is that sometimes there is no space in between words, just the carriage return and it joins the 2 words without spaces. In other occasions it has a space before the carriage return and it works out fine for that case. How can i get it so that there will be only 1 space in between words in the cell without carriage returns?

thanks!
Reply With Quote