How to replace Alt + Enter with space/comma in Excel?
In Excel, pressing "ALT + Enter" allows you to insert a line break within a cell, which can be useful for improving readability or formatting text. However, these line breaks can become inconvenient when you need the data in a single line for further processing or exporting. This guide provides detailed steps to replace "ALT + Enter" (line breaks) with a space, comma, or any other character of your choice.
Understanding ALT + Enter in Excel
Replace Alt + Enter with comma or any other character In Excel
Understanding ALT + Enter in Excel

In Excel, "Alt + Enter" is a keyboard shortcut that inserts a line break within a cell, enabling you to add multiple lines of text in a single cell. This feature is particularly useful for formatting and displaying information neatly, such as addresses, descriptions, or structured data.
The line break is represented as a special character called a Line Feed (LF), which corresponds to the ASCII code 10 and is identified in Excel as CHAR(10).
Mastering the use of "Alt + Enter" is an essential skill for enhancing the organization and readability of your Excel worksheets.
Replace Alt + Enter with comma or any other character In Excel
Here, we will explore several efficient methods to replace Alt+Enter (line breaks), helping you easily resolve data processing issues caused by line breaks. These methods can quickly replace line breaks with spaces, commas, or other specified characters, significantly improving data readability, compatibility, and analysis efficiency.
♦ Replace Alt + Enter with comma or any other character with Find and Replace feature
The simplest way to replace line breaks is by using Excel’s built-in Find and Replace tool.
1. Select the cells where you want to replace the "Alt + Enter" line breaks, 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:
(2) In the "Replace with" box type space or comma as you need;
(3) Click the "Replace All" button. See screenshot:

Now you will see that all Alt + Enter characters have been replaced with your specified character, such as a comma. See screenshot:
- Undo Changes: If you make a mistake, press Ctrl + Z to undo the replacement.
- Partial Replacement: If you only want to replace line breaks in specific cells, use "Find Next" and "Replace" instead of "Replace All".
♦ Replace Alt + Enter with comma or any other character with Kutools for Excel
Kutools for Excel offers a powerful and efficient solution to replace Alt + Enter (line breaks) with commas, spaces, or any other character in just a few clicks!
With the "Replace Any Characters" feature in Kutools for Excel, you can effortlessly handle a variety of complex character replacement tasks, significantly improving the efficiency and accuracy of data processing. Whether you need to replace accented characters, convert letter cases or interchange Chinese and English punctuation marks, this feature can accomplish it all with just one click. Additionally, you can customize replacement rules based on your specific needs, allowing you to flexibly process various special characters or text formats.
After installing Kutools for Excel, please do as this:
- Select the data range that you want to replace. Click "Kutools" > "Text" > "Replace any characters".
- In the "Replace any characters" dialog box, specify the below operations:
(1.) Select "Newlines and spaces" from the "Scenario" drop down list;
(2.) Click OK button.
Result: Kutools will instantly replace all line breaks in the specified range with space characters. See screenshot:
- If you need to replace Alt + Enter line breaks with other characters, such as commas, dashes, or any custom delimiter, simply open the "Replace Any Characters" dialog box, click the "Edit" button, and enter the desired character into the "Replace with" textbox at the bottom. See screenshot:
- If you make a mistake, press Ctrl + Z to undo the replacement.
♦ Replace Alt + Enter with comma or any other character by using formula
If you prefer a non-destructive method (i.e., without altering the original data), you can use Excel formulas to replace line breaks. The SUBSTITUTE function is particularly useful for this purpose.
Enter the following formula into a blank cell, and then drag the formula down to apply it to all relevant cells in the column.
=SUBSTITUTE(A1, CHAR(10), ", ")
- A1: This is the cell reference where the text containing line breaks is located.
- CHAR(10): This function represents the line break character in Excel. CHAR(10) corresponds to the ASCII code for a line feed (newline).
- ,: This is the replacement character, which in this case is a comma and a space. You can replace it with any other character, such as dash (-), or any custom delimiter.
♦ Replace Alt + Enter with comma or any other character with VBA code
If you are familiar with VBA, you can also replace the Alt + Enter characters with a space, comma, or any other character you need 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 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
3. Press F5 key or click the Run button to run this VBA. In the popping out KuTools for Excel dialog box, please select the cells where you want to replace the Alt + Enter line breaks, and click the OK button. See screenshot:
Now you will see that all Alt + Enter line breaks have been replaced with your specified character, such as a comma. See screenshot:
Replacing ALT+ Enter line breaks with a space, comma, or other character in Excel is straightforward with the right approach. Whether you prefer the simplicity of Find and Replace, the flexibility of formulas, or the efficiency of VBA, this guide equips you with multiple options to handle the task efficiently. By applying these methods, you can ensure your data is clean and ready for further processing or analysis. If you're interested in exploring more Excel tips and tricks, our website offers thousands of tutorials to help you master Excel.
Related articles:
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, 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!
All Kutools add-ins. One installer
Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.





- All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
- One installer, one license — set up in minutes (MSI-ready)
- Works better together — streamlined productivity across Office apps
- 30-day full-featured trial — no registration, no credit card
- Best value — save vs buying individual add-in