While working with Excel files, typing content into a cell that's too long often results in the text overflowing into the adjacent column. This article provides guidance on how to automatically wrap text in Excel
For example, when entering text into cell C3 that exceeds the column width, the text gets obscured and isn't displayed properly

1. For a single, unmerged cell (not combined with other cells in the column or row), the process is straightforward:
- Select the cell where you want text to wrap automatically when the column width is exceeded -> go to the Home tab -> Alignment -> choose the Wrap Text feature:

- After selecting Wrap Text, the text content in the cell will automatically wrap when the column width is exceeded:

2. For merged data cells:
- In Excel, when cells are merged, using the Wrap Text feature allows the text content to wrap when the column width is exceeded, but the height of the cell remains unchanged, resulting in obscured text. For example, when merging cell B4 and C4 into one cell, after entering content, selecting the Wrap Text feature won't automatically wrap text when the column width is exceeded:

- In this scenario (cells merged from multiple cells), you need to use additional code after selecting the Wrap Text feature:
+ Select the Excel file where you want text to automatically wrap when the column width is exceeded -> press Alt + F11 to open the command window -> copy the following code for the Change event of the worksheet:
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 Sub

+ After typing the above code, save and exit the VBA, return to the Excel file, re-enter the content for the cell where you want text to automatically wrap when the column width is exceeded. The height of the cell will adjust accordingly, and the text content won't be obscured:

Above is a detailed guide on how to automatically wrap text in Excel - Automatically wrapping text when the column width is exceeded in Excel version 2016. Wishing you success!
