How to replace alt-enter with space/comma in Excel?
For example, there are some cells with carriage returns as below screenshot shown. Now you want to replace these alt-enter characters with space or comma in Excel, how could you deal with it? Actually, both Find and Replace feature and VBA can help you solve the problem.
- 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 easily replace all-enter characters with space or comma by the Find and Replace feature in Excel. Please do as follows:
1. Select the cells you will replace the alt-enter characters, and press Ctrl + H keys to open the Find and Replace dialog box.
2. In the Find and Replace dialog box, under the Replace tab, please:
(1) In the Find What box press Ctrl + J keys to enter alt-enter character;
(2) In the Replace with box type space or comma as you need;
(3) Click the Replace All button. See screenshot:
3. Click the OK button in the popping out Microsoft Excel dialog box. And then close the Find and Replace dialog box.
Now you will see all alt-enter characters are replaced with your specified character, such as a comma. See screenshot:
If you are familiar with VBA, you can also replace the alt-enter characters with space, comma, or any other character as you need with VBA in Excel.
1. Press Alt + F11 keys to open the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and then paste below VBA code into the new module window.
VBA: Replace alt-enter with space/comma in Excel
Sub ReplaceLineBreak() Dim xRg As Range On Error Resume Next Set xRg = Application.InputBox("Select Cells:", "KuTools for Excel", Selection.Address, , , , , 8) If xRg Is Nothing Then Exit Sub xRg.WrapText = False xRg.Replace Chr(10), "Your text here", xlPart, xlByColumns End Sub
Note: Before running the VBA, please find the code xRg.Replace Chr(10), "Your text here", xlPart, xlByColumns, and replace Your text here with space, comma, or other character as you need.
3. Press F5 key or click the Run button to run this VBA.
4. In the popping out KuTools for Excel dialog box, please select the cells you will replace the alt-enter characters, and click the OK button. See screenshot:
Now you will see all alt-enter characters are replaced with you specified character, such as comma. See screenshot: