
When dealing with extensive text that requires line breaks or when you need to format content for balance and aesthetics, pressing Enter in Excel isn't as straightforward as MS Word.
Today, Software Wizardry will guide you through the enchanting tool called Wrap Text, helping you automatically break lines in harmony with the column width!
Utilize Wrap Text to automatically break lines for an individual cell
Imagine you have a spreadsheet, and columns E, F, G boast longer headers than the column width. However, you're reluctant to adjust the column width further.

Step 1: Select the cell you want to auto-wrap. On the Home (1) tab, click on the Wrap Text (2) icon.

Step 2: Excel will automatically adjust the row width (without altering the column width) and wrap text in Excel.

Step 3: For column F, although text wrapping is automatic, the break isn't aesthetically pleasing due to the column width. Here's where you can add the automatic column width adjustment for column F to make it just right.

Automatically Break Lines for Merged Data Cells
The Wrap Text tool is limited to individual cells; it doesn't automatically break lines for merged cells created using Merge & Center. To achieve automatic line breaks for merged cells, you can use the following Macro:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim NewRwHt As Single
Dim cWdth As Single, MrgeWdth As Single
Dim c As Range, cc As Range
Dim ma As Range
With Target
If .MergeCells And .WrapText Then
Set c = Target.Cells(1, 1)
cWdth = c.ColumnWidth
Set ma = c.MergeArea
For Each cc In ma.Cells
MrgeWdth = MrgeWdth + cc.ColumnWidth
Next
Application.ScreenUpdating = False
ma.MergeCells = False
c.ColumnWidth = MrgeWdth
c.EntireRow.AutoFit
NewRwHt = c.RowHeight
c.ColumnWidth = cWdth
ma.MergeCells = True
ma.RowHeight = NewRwHt
cWdth = 0: MrgeWdth = 0
Application.ScreenUpdating = True
End If
End With
End SubOpen the VBA window by pressing Alt + F11. On the sheet name containing the cell you want to automatically break lines, right-click, and select Insert -> Module.

Paste the provided code into the Module window.

Return to the Worksheet, double-click on the desired cell, and then press the Enter key to automatically break lines.
The obtained result will resemble the image below:

Wishing you all the best success!
