+ Reply to Thread
Results 1 to 3 of 3

Fixing multiline cell

  1. #1
    TonyL
    Guest

    Fixing multiline cell

    I have exported an Outlook address book to a csv file & have opened the file
    in Excel. The address field is a multiline field with Chr(10) designating a
    new line. I am trying to convert from multiline to separate fields. Each
    line is a new field. I am trying to replace the Chr (10) to a ~ then I can
    format into separate fields using the Text to Columns function.

    My problem is that I cannot see how to replace the Chr(10)

    I have seen the following macro in a previous post which I modified but this
    does not replace the Chr(10) but adds the ~ after the Chr(10)

    Sub CharacterReturn()
    '
    ' CharacterReturn Macro
    '
    'removes carriage returns from A1 down
    Dim Rng, r As Range
    Set Rng = Range(Cells(1, 1), _
    Cells(ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row, 1))
    For Each r In Rng
    r.Value = Application.Substitute(Trim(CStr(r.Value)), Chr(10), "")
    Next r

    End Sub


    Any help would be greatly appreciated. TIA
    --
    Tony

  2. #2
    Ron Coderre
    Guest

    RE: Fixing multiline cell

    Have you tried this?:

    Select the cells with carriage returns (char 10's)
    <Edit><Replace>
    Find what: Hold down the [Alt] key, type 0010 then release the [Alt] key
    Replace with: ~
    Click the [Replace All] button

    That should replace all of the carriage returns in the selected cells with
    tildes

    Does that help?

    ***********
    Regards,
    Ron

    XL2002, WinXP-Pro


    "TonyL" wrote:

    > I have exported an Outlook address book to a csv file & have opened the file
    > in Excel. The address field is a multiline field with Chr(10) designating a
    > new line. I am trying to convert from multiline to separate fields. Each
    > line is a new field. I am trying to replace the Chr (10) to a ~ then I can
    > format into separate fields using the Text to Columns function.
    >
    > My problem is that I cannot see how to replace the Chr(10)
    >
    > I have seen the following macro in a previous post which I modified but this
    > does not replace the Chr(10) but adds the ~ after the Chr(10)
    >
    > Sub CharacterReturn()
    > '
    > ' CharacterReturn Macro
    > '
    > 'removes carriage returns from A1 down
    > Dim Rng, r As Range
    > Set Rng = Range(Cells(1, 1), _
    > Cells(ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row, 1))
    > For Each r In Rng
    > r.Value = Application.Substitute(Trim(CStr(r.Value)), Chr(10), "")
    > Next r
    >
    > End Sub
    >
    >
    > Any help would be greatly appreciated. TIA
    > --
    > Tony


  3. #3
    Don Guillett
    Guest

    Re: Fixing multiline cell

    try thishttp://tinyurl.com/zkcga
    --
    Don Guillett
    SalesAid Software
    [email protected]
    "TonyL" <[email protected]> wrote in message
    news:[email protected]...
    >I have exported an Outlook address book to a csv file & have opened the
    >file
    > in Excel. The address field is a multiline field with Chr(10) designating
    > a
    > new line. I am trying to convert from multiline to separate fields. Each
    > line is a new field. I am trying to replace the Chr (10) to a ~ then I
    > can
    > format into separate fields using the Text to Columns function.
    >
    > My problem is that I cannot see how to replace the Chr(10)
    >
    > I have seen the following macro in a previous post which I modified but
    > this
    > does not replace the Chr(10) but adds the ~ after the Chr(10)
    >
    > Sub CharacterReturn()
    > '
    > ' CharacterReturn Macro
    > '
    > 'removes carriage returns from A1 down
    > Dim Rng, r As Range
    > Set Rng = Range(Cells(1, 1), _
    > Cells(ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row, 1))
    > For Each r In Rng
    > r.Value = Application.Substitute(Trim(CStr(r.Value)), Chr(10), "")
    > Next r
    >
    > End Sub
    >
    >
    > Any help would be greatly appreciated. TIA
    > --
    > Tony




+ 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