+ Reply to Thread
Results 1 to 3 of 3

How to remove or replace a carriage return character in a cell?

  1. #1
    Patty
    Guest

    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. #2
    Dave Peterson
    Guest

    Re: How to remove or replace a carriage return character in a cell?

    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. #3
    Ron Coderre
    Guest

    RE: How to remove or replace a carriage return character in a cell?

    Try this:

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

    Edit>Replace
    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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1