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:
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
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
You are guest
or post as a guest, but your post won't be published automatically.
- To post as a guest, your comment is unpublished.· 4 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.· 5 years agoThank you very much. it is really superb
- To post as a guest, your comment is unpublished.· 5 years agoThank you werry helpfull for my and my MYSQL CSV import :-)
- To post as a guest, your comment is unpublished.· 5 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.· 6 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.