How to automatically wrap lines in Excel (Wrap Text in Excel)

How to automatically wrap lines in Excel (Wrap Text in Excel) Picture 1

For long paragraphs of text, you need to break a line or you need a new line to align the content so that it is balanced and beautiful. However, line breaks in Excel are not as simple as pressing Enter as in MS Word software.

Today, Dexterity Software will guide you to the Warp Text tool to automatically wrap lines that match the width of the column!

Use Warp Text to automatically wrap lines for an individual cell

For example, if you have the following worksheet, columns E, F, G have longer headers than the width of the column. You do not want to adjust the width of the column.

How to automatically wrap lines in Excel (Wrap Text in Excel) Picture 2

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

How to automatically wrap lines in Excel (Wrap Text in Excel) Picture 3

Step 2: Excel will automatically adjust the width of the row (without adjusting the width of the column) and down the line in Excel.

How to automatically wrap lines in Excel (Wrap Text in Excel) Picture 4

Step 3: For column F, despite automatic adjustment, the line breaks are not aesthetic due to the width of the column. So you can add the operation automatically adjusts the width of column F accordingly.

How to automatically wrap lines in Excel (Wrap Text in Excel) Picture 5

Automatically breaks data cells that are merged from multiple cells

The Warp Text tool can only be applied to individual cells, with cells merged with the Merge & Center tool not automatically breaking lines. So to auto-break lines for merged cells you can use by running the following Marco:

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

Open VBA window by pressing the key combination Alt + F11 , On the Sheet name contains the cell you want to automatically wrap the line you right-click select Insert -> Module .

How to automatically wrap lines in Excel (Wrap Text in Excel) Picture 6

Copy the above code into the Module window.

How to automatically wrap lines in Excel (Wrap Text in Excel) Picture 7

Return to Work Sheet, double-click the cell you want to auto-break, and then press the Enter button to automatically wrap the line.

The result is as shown below:

How to automatically wrap lines in Excel (Wrap Text in Excel) Picture 8

Good luck!

3.5 ★ | 2 Vote

May be interested

  • Absolute and relative addresses in ExcelPhoto of Absolute and relative addresses in Excel
    absolute and relative addresses in excel. relative addresses are addresses that change when copying a formula. this is the default address when we formulate the formula. for example a1, b2 ... the absolute address is the one that was not changed when copying the formula. the absolute address is distinguished from the absolute address with the character $. for example $ a1 $ 1, $ b1 $ 2….
  • Quickly insert multiple images at once in ExcelPhoto of Quickly insert multiple images at once in Excel
    today dexterity software will guide you how to quickly insert rows of images at once in excel with the tool ablebit for excel.
  • Excel date function - Usage and examplesPhoto of Excel date function - Usage and examples
    the date counting function in excel is one of the most effective functions of this software. because excel usually works in the field of statistics and calculations, it is extremely necessary to record dates. to help you understand this function, let's come to the following article of tipsmake.
  • How to lock Excel files from editingPhoto of How to lock Excel files from editing
    you want to send an excel file that can only be read by the recipient and cannot change the data information in the file. in this article, tipsmake.com would like to show you how to lock excel files from editing correctly.
  • How to separate text strings by commas or spaces in ExcelPhoto of How to separate text strings by commas or spaces in Excel
    separating text strings based on commas or spaces is a trick that helps you split the characters in a parameter cell into different clusters based on commas or spaces that parameter cell contains. tipsmake will guide you how to separate text strings by commas or spaces in excel.
  • How to sort data in Excel Ascending and descending, according to ABCPhoto of How to sort data in Excel Ascending and descending, according to ABC
    sorting lists in alphabetical order or descending order is often used in lists of names of people, searching for elements with the greatest number of values. and the arrangement of such data is not difficult with the help of excel in the following article of tipsmake.com.