Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Patty
 
Posts: n/a
Default How to remove or replace a carriage return character in a cell?

After importing a Cognos "hotfile" into excel, the cell contains a carriage
return character (looks like a square) and I want this to be a new line feed.
I have tried to determine how to do a find and replace, but no luck. Help!
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

Saved from a previous post:

You can use Chip Pearson's Cell View addin to find out the character it is:
http://www.cpearson.com/excel/CellView.htm

If those box characters are char(10)'s (alt-enters), you can use
edit|Replace
what: ctrl-j
with: (spacebar??)
replace all

If that box character is something else, you may need a macro:

Option Explicit
Sub cleanEmUp()

Dim myBadChars As Variant
Dim myGoodChars As Variant
Dim iCtr As Long

myBadChars = Array(Chr(13)) '<--What showed up in CellView?

myGoodChars = Array(" ") '<--what's the new character?

If UBound(myGoodChars) < UBound(myBadChars) Then
MsgBox "Design error!"
Exit Sub
End If

For iCtr = LBound(myBadChars) To UBound(myBadChars)
ActiveSheet.Cells.Replace What:=myBadChars(iCtr), _
Replacement:=myGoodChars(iCtr), _
LookAt:=xlPart, SearchOrder:=xlByRows, _
MatchCase:=False
Next iCtr

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Patty wrote:

After importing a Cognos "hotfile" into excel, the cell contains a carriage
return character (looks like a square) and I want this to be a new line feed.
I have tried to determine how to do a find and replace, but no luck. Help!


--

Dave Peterson
  #3   Report Post  
Ron Coderre
 
Posts: n/a
Default

Try this:

Edit one of the cells, select only the square character, copy it [Ctrl]+C ,
then press [Esc]

EditReplace
Find what: Paste in the character [Ctrl+V]
Replace with: Hold down the [Alt] key, type 010, release the [Alt] key.
Click [Replace All]


Does that help?

--
Regards,
Ron


"Patty" wrote:

After importing a Cognos "hotfile" into excel, the cell contains a carriage
return character (looks like a square) and I want this to be a new line feed.
I have tried to determine how to do a find and replace, but no luck. Help!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to find replace text or symbol with carriage return jo New Users to Excel 11 April 4th 23 10:41 AM
how do I remove Carriage Returns from a column in a spreadsheet? Doug R Excel Discussion (Misc queries) 1 June 29th 05 08:29 PM
Search and replace with Carriage return Andibevan Excel Discussion (Misc queries) 2 May 17th 05 12:43 PM
Strip carriage return, add row adin Excel Worksheet Functions 18 April 26th 05 10:03 AM
Carriage Return in Excel Rod Behr Excel Discussion (Misc queries) 4 December 14th 04 01:53 PM


All times are GMT +1. The time now is 05:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"