+ Reply to Thread
Results 1 to 8 of 8

Preserving line breaks when referring to text in another cell

  1. #1
    Registered User
    Join Date
    12-22-2006
    Posts
    3

    Preserving line breaks when referring to text in another cell

    Hello,

    I've got an odd problem which I would appreciate any advice on.

    I have some text in a cell, which breaks over several lines, separated by ALT+ENTER (i.e. an ANSI character 10). I am trying to refer to that cell in another cell (e.g. by putting in cell B1 the formula '=A1' where A1 contains the text). It works, except that the line breaks are lost and the text all comes out on one line. If you go through the text character by character, the ANSI code 10 characters are still there, but for some reason they don't cause a line break in that cell as they do in the original. I have even tried using SUBSTITUTE to replace them all with 13's, but that doesn't help at all.

    Many thanks for any pointers!

    All best wishes,

    James.

  2. #2
    Forum Contributor
    Join Date
    03-14-2006
    Location
    Pakistan
    Posts
    1,791

    Lightbulb

    Quote Originally Posted by JamesG28
    Hello,

    I've got an odd problem which I would appreciate any advice on.

    I have some text in a cell, which breaks over several lines, separated by ALT+ENTER (i.e. an ANSI character 10). I am trying to refer to that cell in another cell (e.g. by putting in cell B1 the formula '=A1' where A1 contains the text). It works, except that the line breaks are lost and the text all comes out on one line. If you go through the text character by character, the ANSI code 10 characters are still there, but for some reason they don't cause a line break in that cell as they do in the original. I have even tried using SUBSTITUTE to replace them all with 13's, but that doesn't help at all.

    Many thanks for any pointers!

    All best wishes,

    James.
    Hi
    right click on that cell, select Formate cells, under Alignment tab check Wrap text and press Ok
    then adjust col width accordingly

    Regards.

  3. #3
    Registered User
    Join Date
    12-22-2006
    Posts
    3
    Many thanks, Starguy, but no joy I am afraid. The problem doesn't seem to be a formatting issue per se. In the original cell, there are a number of forced line breaks, generated by typing ALT+ENTER within the entry bar at the top of the sheet. As a result, the text occupies several lines, with anything from a few characters to a few words on each line. When I refer to that cell in another cell, those forced line breaks don't come across. The text occupies a single line, or breaks in different places if I turn on wordwrap and shrink the column. The actual ANSI line break character does come across, it is a CHAR(10), but it doesn't appear to have the same effect in the destination cell as it does in the source cell.

    Incidentially, I am using Excel 2007 B2TR - I don't know if the same thing occurs in other versions of the software.

    Best wishes,

    James.

  4. #4
    Forum Contributor
    Join Date
    03-14-2006
    Location
    Pakistan
    Posts
    1,791

    Lightbulb

    Hi

    wrapping text should work
    see attached file.
    Attached Files Attached Files
    Last edited by starguy; 12-22-2006 at 06:09 AM.

  5. #5
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Quote Originally Posted by JamesG28
    Many thanks, Starguy, but no joy I am afraid. The problem doesn't seem to be a formatting issue per se. In the original cell, there are a number of forced line breaks, generated by typing ALT+ENTER within the entry bar at the top of the sheet. As a result, the text occupies several lines, with anything from a few characters to a few words on each line. When I refer to that cell in another cell, those forced line breaks don't come across. The text occupies a single line, or breaks in different places if I turn on wordwrap and shrink the column. The actual ANSI line break character does come across, it is a CHAR(10), but it doesn't appear to have the same effect in the destination cell as it does in the source cell.

    Incidentially, I am using Excel 2007 B2TR - I don't know if the same thing occurs in other versions of the software.

    Best wishes,

    James.
    Here's a way to keep the line breaks, use your formula = A1, then use the Format Paintbrush, click on A1, then on your formula cell.
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  6. #6
    Forum Contributor
    Join Date
    03-14-2006
    Location
    Pakistan
    Posts
    1,791

    Lightbulb

    Quote Originally Posted by oldchippy
    Here's a way to keep the line breaks, use your formula = A1, then use the Format Paintbrush, click on A1, then on your formula cell.
    Hi oldchippy

    this will result in same thing i-e wrapping the text.
    if you see the format of A1 (which is with line breaks you will see wrap text option checked) and when you use Paint Brush it will also copy the format i-e wrap text will be checked in other cell as well.

  7. #7
    Registered User
    Join Date
    12-22-2006
    Posts
    3
    Success! Somehow, using the format paintbrush worked when formatting the cell itself didn't. Strange, but effective. Many thanks for all the help, guys!

    James

  8. #8
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Glad you got what you wanted in the end - Thanks for the feedback and a Merry Christmas

+ 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