Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-04-2019, 09:50 AM
abenitez77 abenitez77 is offline remove carriage return Windows 10 remove carriage return Office 2016
Novice
remove carriage return
 
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
  #2  
Old 04-04-2019, 01:38 PM
abenitez77 abenitez77 is offline remove carriage return Windows 10 remove carriage return Office 2016
Novice
remove carriage return
 
Join Date: Apr 2019
Posts: 9
abenitez77 is on a distinguished road
Default

I just figured it out...I just did these 2 lines:
Code:
Sheets(1).Cells.Replace What:=Chr(10), Replacement:=" "
Sheets(1).Cells.Replace What:=" ", Replacement:=" "

Last edited by abenitez77; 04-05-2019 at 04:45 AM.
Reply With Quote
  #3  
Old 04-04-2019, 11:41 PM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline remove carriage return Windows 7 64bit remove carriage return Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,766
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

Code tags please...
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
carriage return on PPT yangthomson PowerPoint 0 04-21-2016 07:16 PM
remove carriage return weird ctrl+carriage return paik1002 Word 1 03-30-2016 12:16 AM
Inserting Carriage Return rsrasc Word VBA 4 02-15-2015 11:23 PM
remove carriage return Coding into a macro a carriage return sinbad Word VBA 6 02-27-2012 03:51 AM
Carriage Return Help UCHelp Word 1 04-04-2010 10:11 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:18 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft