Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to quickly remove line breaks in Excel?

Sometimes, when you copy some data from the website or you separate your values with Alt + Enter keys, you will get some line breaks or carriage returns, if you want to quickly remove multiple line breaks in Excel as following screenshots shown, you can get it done as follows:

doc-remove-line-breaks1 -2 doc-remove-line-breaks2

Remove multiple line breaks with Find and Replace function

Remove multiple line breaks with VBA code

Remove multiple line breaks with Kutools for Excel



arrow blue right bubble Remove multiple line breaks with Find and Replace function

You can remove multiple line breaks quickly with Find and replace function in Excel, please process it as follows:

1. Select the range that you want to remove multiple line breaks.

2. Click Home > Find & Replace > Replace or click Ctrl + F shortcuts, and a Find and Replace dialog box will pop out.

3. Then in the Find what box, please hold down the ALT key, and then click numbers 010 from the numeric keyboard. Leave the Replace with box blank or enter a space bar. See screenshot:

doc-remove-line-breaks3

4. And then click Replace All button, all of the line breaks have been removed. See screenshot:

doc-remove-line-breaks2


arrow blue right bubble Remove multiple line breaks with VBA code

The following VBA code can also help you to delete all of line breaks in a worksheet. Please do as this:

1. Click Developer > Visual Basic or press Alt+F11 keys to open the Microsoft Visual Basic for applications window, then click Insert > Module, and input the following code:

VBA code: remove multiple line breaks in a worksheet

Sub RemoveCarriage()
'Update 20131216
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each Rng In WorkRng
    Rng.Value = Replace(Rng.Value, Chr(10), "")
Next
End Sub

2. Then press F5 key to run this code, and a prompt box will appear to tell you to select a range that you want to remove the line breaks, see screenshot:

doc-remove-line-breaks4

3. Then click OK and all the line breaks of the selection have been deleted.


arrow blue right bubble Remove multiple line breaks with Kutools for Excel

Maybe sometimes you will forget how to use the Find and Replace function or not familiar with the code to remove multiple line breaks, in this situation, Kutools for Excel can help you to solve this problem.

Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. Get it Now

After installing Kutools for Excel, please do as following steps:

1. Select the range that you want to remove the carriage returns.

2. Click Kutools > Text Tools > Remove Characters, see screenshot:

doc-remove-line-breaks5

3. In the Remove Characters dialog box, check Non-printing option, and you can see the result from the Preview pane as well, see screenshot:

doc-remove-line-breaks6

4. And then click OK or Apply. All of the line breaks will be removed from the selected cells.

Click to know more about this Remove Characters feature.


Related Articles:


Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Ajay Kumar Mohini · 3 years ago
    Thank You so much yaar. I found it very useful for my day to day office works.
  • To post as a guest, your comment is unpublished.
    Balamurugan · 4 years ago
    Thank you very much. it is really superb
  • To post as a guest, your comment is unpublished.
    meter21 · 4 years ago
    Thank you werry helpfull for my and my MYSQL CSV import :-)
  • To post as a guest, your comment is unpublished.
    Mary Pugh · 4 years ago
    THANK YOU!!! I have been battling blank lines in cell for too long.

    You solved the problem...thank you so much
  • To post as a guest, your comment is unpublished.
    kcjt2009 · 5 years ago
    I am very inexperienced when it comes to macros/VBA code. How would I tweak the code you provided above and which I have pasted below to search for 2 consecutive carriage returns and replace with just one carriage return?

    Sub RemoveCarriage()
    'Update 20131216
    Dim Rng As Range
    Dim WorkRng As Range
    On Error Resume Next
    xTitleId = "KutoolsforExcel"
    Set WorkRng = Application.Selection
    Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
    For Each Rng In WorkRng
    Rng.Value = Replace(Rng.Value, Chr(10), "")
    Next
    End Sub


    Also, how would I locate and delete single carriage returns that have no text after them in a cell. Thank you for any assistance.