+ Reply to Thread
Results 1 to 9 of 9

Removing unnecessary line breaks after the texts

  1. #1
    Registered User
    Join Date
    11-20-2012
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2007
    Posts
    4

    Removing unnecessary line breaks after the texts

    Hello,

    Here's my problem:

    ---------------------------
    Example Text 1
    Example Text 2
    Example Text 3


    ---------------------------

    I want to remove the line breaks after "Example Text 3" without affecting the line breaks of the texts? Here's what I need:

    ---------------------------
    Example Text 1
    Example Text 2
    Example Text 3
    ---------------------------

    Thanks in advance!

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: Removing unnecessary line breaks after the texts

    You could try using Find& Replace (CTRL-H) and in the Find What box hold down the Alt key and type 010 on the numeric keypad (do this twice), leave the Replace box empty, then click Replace All.

    It worked for me in a test sample.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    11-20-2012
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Removing unnecessary line breaks after the texts

    Hello Pete,

    Thanks for your answer. Sorry I wasn't able to tell that the number of trailing line breaks differs from one cell to another. Some cells have only 1 line break, some has 3, some has 5. Is there a quick way to remove all of them using a code?

    - Oliver

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: Removing unnecessary line breaks after the texts

    The procedure I gave you is to remove pairs of line breaks, so you might have to do it twice if you have an odd number to start with.

    The ASCII code is 10 for those line breaks, so you could use a formula with CHAR(10) and SUBSTITUTE, but Find & Replace is quicker.

    Hope this helps.

    Pete

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Removing unnecessary line breaks after the texts

    VBA
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    11-20-2012
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Removing unnecessary line breaks after the texts

    Hi jindon,

    Just tried the code and it worked. The problem is, it worked only on column A. How can I do it in the entire sheet?

    Thanks in advance,
    Oliver

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Removing unnecessary line breaks after the texts

    Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-20-2012
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Removing unnecessary line breaks after the texts

    hey jindon, you are a rockstar! you saved me a lot of time, thanks a lot mate!

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Removing unnecessary line breaks after the texts

    OK, don't forget to mark this thread as "Solved".

+ 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