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:
Recommended Productivity Tools for Excel
Office Tab: Bring powerful tabs to Office (include Excel), just like Chrome, Safari, Firefox and Internet Explorer. Save you half the time, and reduce thousands of mouse clicks for you. 30-day Unlimited Free Trial
Kutools for Excel: Save 71% of your time and solve 82% Excel problems for you. 300+ advanced tools designed for 1500+ work scenario, make Excel much easy and increase productivity immediately.60-day Unlimited Free Trial
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:
4. And then click Replace All button, all of the line breaks have been removed. See screenshot:
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:
3. Then click OK and all the line breaks of the selection have been deleted.
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.
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:
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:
4. And then click OK or Apply. All of the line breaks will be removed from the selected cells.
- Remove alpha characters from cells
- Remove non numeric characters from cells
- Remove numeric characters from cells
- Remove non-printable characters from cells
- Remove non-alpha characters from cells
Recommended Productivity Tools
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
To post as a guest, your comment is unpublished.· 3 years agoThank 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.· 4 years agoThank you very much. it is really superb
To post as a guest, your comment is unpublished.· 4 years agoThank you werry helpfull for my and my MYSQL CSV import :-)
To post as a guest, your comment is unpublished.· 4 years agoTHANK 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.· 5 years agoI 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?
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), "")
Also, how would I locate and delete single carriage returns that have no text after them in a cell. Thank you for any assistance.