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


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.

Combine rows/columns into to one cell and separate with space, comma, new line, etc.

Kutools for Excel’s Combine Columns or Rows utility can help Excel users easily combine multiple columns or rows into one columns/row without losing data. In addition, Excel users can wrap these combined text strings with carriage or hard return, comma, space, semicolone, etc. Full Feature Free Trial 60-day!
ad combine rows columns newline

Replace alt-enter with space/comma by Find and Replace feature

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:

Replace alt-enter with space/comma by VBA

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:

Related articles:

Recommended Productivity Tools for Excel

Kutools for Excel Helps You Always Finish Work Ahead of Time, and Stand Out From Crowd

  • More than 300 powerful advanced features, designed for 1500 work scenarios, increasing productivity by 70%, give you more time to take care of family and enjoy life.
  • No longer need memorizing formulas and VBA codes, give your brain a rest from now on.
  • Become an Excel expert in 3 minutes, Complicated and repeated operations can be done in seconds, 
  • Reduce thousands of keyboard & mouse operations every day, say goodbye to occupational diseases now.
  • 110,000 highly effective people and 300+ world-renowned companies' choice.
  • 60-day full features free trial. 60-day money back guarantees. 2 years of free upgrade and support.

Brings Tabbed Browsing and Editing to Microsoft Office, Far More Powerful Than The Browser's Tabs

  • Office Tab is designed for Word, Excel, PowerPoint and Other Office Applications: Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
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.

Be the first to comment.