Wrapping text in Excel means displaying all the contents of a cell over multiple lines. It comes in handy when dealing with long text entries. Wrap text prevents long numbers, codes, or URLs from being cut off.
In this tutorial, you will learn everything about wrapping text in Excel.
In the following dataset, we want to wrap the texts in the Product Description column as they are not visible properly. The following overview GIF shows how the wrap text works in Excel. Select the cells, go to the Home tab, and click the Wrap Text option.
In this blog post, you will learn how to wrap text in Excel
– Using Wrap Text Option
– Using Format Cells Dialog Box
– Using Keyboard Shortcuts
– Using AutoFit Column Width
– Inserting Line Break
– Using Excel VBA
You can also learn
– to wrap texts in merged Cells
– to unwrap texts
– possible reasons and solutions when Wrap Text feature does not work
While writing the article, I used Microsoft 365. Don’t worry! The Wrap Text feature is available from Excel version 2007 or later.
⏷ What Is Meant by Text Wrapping?
⏷ Why Use Text Wrapping?
⏷ Wrap Text Automatically
⏵ Using Wrap Text Option
⏵ Using Format Cells Dialog Box
⏵ Using Keyboard Shortcuts
⏵ Using AutoFit Column Width Options
⏷ Wrap Text Manually
⏵ Inserting Line Break
⏷ Wrap Text Using VBA
⏷ Wrap Text in Merged Cells
⏷ Wrap Text on Mac
⏷ Unwrap Text
⏷ Wrap Text Feature Not Working
⏷ Things to Keep in Mind
What Is Meant by Text Wrapping?
In Excel, wrap text means displaying the contents of a cell on multiple lines rather than one single line. It refers to making long sentences or words fit inside a cell without getting cut off. Typically, text in a cell only shows in one line. However, we can display several lines within the same cell by wrapping text. Instead of making the cell bigger, wrapping a text fits the cell contents in a better way.
Why Do We Need to Wrap Text in Excel?
We need to wrap text in Excel-
- to view all the information within a cell in case of long sentences.
- to prevent any piece of information from being overlooked behind other cells.
- to improve the look of your Excel document.
- to reduce the number of pages printed while printing the spreadsheet.
How To Wrap Text Automatically in Excel
1. Using Wrap Text Option from Home Tab
We can easily and automatically wrap text in Excel cell by using the Wrap Text option.
- First, select range D6:D13 and go to Home.
- Later, click on Wrap Text from the Alignment group.
Finally, we will be able to make the text automatically wrap around in Excel.
2. Using Format Cells Dialog Box
Applying the Format Cells needs more steps than wrapping texts using the Wrap Text option. However, using the Format Cells for wrapping text will save us time when we need to apply other formatting besides wrapping.
- To begin, select the D6:D13 range and press Ctrl+1.
Due to this, the Format Cells window will appear.
- Next, go to the Alignment tab.
- Check Wrap Text from Text Control and hit OK.
As a result, we will see an output like the following one.
3. Using Keyboard Shortcut
We can easily use the wrap text command using shortcut key in Excel.
- Select the D6:D13 range and press Alt+H.
- After that, press W to apply Wrap Text.
Finally, we will see an output like the below one.
4. Using AutoFit Column Width Option
Using the AutoFit Column Width option, we can easily display the whole text inside a cell. To do so,
- Select cells where you want to wrap text. We selected D6:D13.
- Go to the Home tab.
- Expand Format option from Cells group.
- Select AutoFit Column Width.
You will see that the columns are automatically expanded to display the entire text’s contents.
How To Wrap Text Manually in Excel
Insert Line Breaks to Manually Wrap Text
You can manually wrap text by inserting line breaks. We do not recommend applying this idea often because it will take longer than other methods.
- Select a cell and go to the Formula bar.
- Place the cursor where you want to insert a line break.
- Press Alt+Enter.
- After inserting the intended line breaks, press Enter.
Now, if you select cell D6, we will see the Wrap Text feature is enabled.
We can apply the same format as D6 to other cells using Format Painter. This will save time and effort.
- Select cell D6.
- Go to Home >> click on Format Painter.
- Select the range D7:D13 to apply the same format as D6.
Finally, we will see the result. Thus, we have applied the Wrap Text feature manually.
Following the same procedure, you can also write a paragraph in an Excel cell. Turn on the Wrap Text option, type the text in a cell, and insert a line break where necessary.
Place the cursor where a new line starts to remove the manual line break for a cell. Later, press Backspace to remove line breaks one by one.
If you ever feel like removing these Link breaks at a time, select the intended cells and press Ctrl+H. As a result, the Find and Replace window will appear. Later, place your cursor to Find what section and press Ctrl+J. Next, keep the Replace with section empty and click on Replace all.
Differences Between Wrap Text Feature and Line Breaks
There is an exciting difference between the Wrap Text feature and Line Breaks, which you may miss noticing.
To demonstrate the difference, we are considering two cells containing long texts. Assume in cell B6, we have applied the Wrap Text feature. In contrast, in cell E6, we have inserted link breaks.
Applying the Wrap Text feature directly in a cell lets you see the whole text in a single line within the formula bar.
Applying the Line Breaks in a cell will not let you see the whole text within the formula bar.
How to Wrap Text Using Excel VBA
We will use Excel VBA wrap text property to wrap text in a cell, range, row, column, entire worksheet, etc.
1. Wrapping Text in a Cell
We will run an Excel VBA code to apply the wrap text feature within cell D6.
- Activate the intended sheet.
- Go to Developer and click on Visual Basic.
Due to this, the VBA Editor window will appear.
- Click on Insert followed by Module.
- Insert the following code in the module and Run.
Sub WrapCell()
Cells(6, 4).WrapText = True
End Sub
Alternatively, we can wrap text in a cell using the following code.
Sub WrapCellAlternative()
Range("D6").WrapText = True
End Sub
As a result, we can see that the Wrap Text feature is enabled for cell D6.
2. Wrapping Text in Range
We will apply the wrap text feature in the range D6:D13 by running the VBA code.
- First, activate the intended sheet.
- Navigate to Developer and click on Visual Basic.
As a result, the VBA Editor window will open.
- Hover over Insert and click on Module.
- Insert the following code in the module and Run.
Sub WrapRange()
Range("D6:D13").WrapText = True
End Sub
Finally, you can see that the Wrap Text feature is enabled for cell range D6:D13.
3. Wrapping Text in Selected Range
We will run a VBA code to apply the wrap text feature in the Selected range.
- To begin, select the D6:D13 range.
- Go to Developer and click on Visual Basic.
Consequently, the VBA Editor window will open.
- Hover over Insert and click on Module.
- Insert the code below in the module and Run.
Sub WrapSelectedRange()
Dim selectedRange As Range
Dim cell As Range
If Selection.Cells.Count = 1 Then
Set selectedRange = ActiveSheet.UsedRange
Else
Set selectedRange = Selection
End If
For Each cell In selectedRange
cell.WrapText = True
Next cell
Selection.Rows.AutoFit
End Sub
Lastly, you can see that the Wrap Text feature is enabled for the selected range.
4. Wrapping Text in Used Range
We will wrap text within the Used Range in the intended sheet in this context. The cells containing any values or formulas are known as the Used Range.
- Go to Developer and click on Visual Basic.
Due to this, the VBA Editor window will open.
- Hover over Insert and click on Module.
- Insert the following code in the module and Run.
Sub WrapUsedRange()
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("In Used Range (VBA)")
ws.UsedRange.WrapText = True
End Sub
Selecting any cell among the Used Range will show that the Wrap Text is enabled.
5. Wrapping Text in Entire Row
Here, we will run a VBA code to enable Wrap Text for the Entire Row 6.
- Open the VBA Editor.
- Select Insert and click on Module.
- Insert the following code and Run.
Sub WrapEntireRow()
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("In Entire Row (VBA)")
ws.Range("6:6").WrapText = True
End Sub
Lastly, you can see that the Row 6 texts are wrapped.
6. Wrapping Text in Entire Column
Here, we will apply a VBA code to enable Wrap Text for the Entire Column D.
- In the Visual Basic Editor window, hover over Insert and click Module.
- Paste the following code and Run.
Sub WrapEntireColumn()
Range("D:D").WrapText = True
End Sub
Lastly, insert any long text within any cell of Column D and get the result.
7. Wrapping Text in Entire Worksheet
We will present a VBA code to wrap text for entire sheet in Excel.
- Open the VBA Editor.
- Click on Insert followed by Module.
- Paste the following code and Run.
Sub WrapEntireWorksheet()
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("In Entire Worksheet (VBA)")
ws.Cells.WrapText = True
End Sub
Selecting any cell that belongs to that sheet will show that the Wrap Text is enabled.
Using VBA, we can also loop through all sheets in a workbook and apply Wrap Text in all sheets. To do that, use the following code.
Sub WrapAllWorksheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
Cells.WrapText = True
Next ws
End Sub
8. Wrapping Text in Non-contiguous Range
In this part, we will enable Wrap Text for Non-contiguous Range.
- Go to Developer >> Visual Basic.
- Click on Insert >> Module.
- Paste the following code and press Run.
Sub WrapNoncontiguousRange()
Range("D6:D13,C16:C17").WrapText = True
End Sub
Finally, we can see that Wrap Text is enabled for the D6:D13 and C16:C17 ranges.
9. Wrapping Text in Named Range
Here, we will enable Wrap Text for a Named Range.
- Select the D6:D13 range and type Product Description in the Name Box to create a Named Range.
- Insert a Module in Visual Basic Editor.
- Then, insert the following code and Run.
Sub WrapUsedRange()
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("In Used Range (VBA)")
ws.UsedRange.WrapText = True
End Sub
As a result, we will see an output like the following one.
How to Wrap Text in Merged Cells in Excel
In this section, we will wrap text in merged cells in Excel. You can see that cells in the Product Description column are merged.
- Select the merged cells and right-click on them to open the context menu.
- Click on the Format Cells.
- Format Cells dialog box will open.
- Click on the Alignment.
- Check the Wrap text box under the Text control.
- Press OK.
You will see the Wrap Text option enabled but not working.
We need to change the row height to make the wrapped text visible.
- Select the cells D6:D13.
- Go to Home > Expand Format.
- Select Row Height under Cell Size.
- Set Row Height to 45 and press OK.
Now, you can see all the wrapped texts in merged cells.
How Do You Wrap Text on a Mac?
On a Mac, we can wrap text by going to the Format menu after choosing the cells. Next, check the Wrap Text box and click OK.
How to Unwrap Text in Excel
We can unwrap texts in Excel using methods similar to wrapping texts.
1. Unwrap Text by Deselecting Wrap Text Option
- Select the intended cells and go to the Home tab.
- Next, deselect the Wrap Text option.
As a result, the output will look like the below one.
2. Use Format Cells Window to Unwrap Text
- To begin, choose the intended cells.
- After that, right-click on any selected cell and choose Format Cells.
The Format Cells window will appear.
- Next, go to the Alignment tab.
- Uncheck Wrap Text from Text Control and hit OK.
As a result, we will see an output like the following one.
3. Apply a Keyboard Shortcut to Unwrap Text
- Initially, select the desired cells and press Alt+H+W.
As a result, the output will look like this:
4. Using Excel VBA
For using VBA to unwrap text, we must set the WrapText property to False in Excel. Assume you want to unwrap text in range D6:D13.
Go to the Developer tab and select the Visual Basic option.
- Insert a Module in Visual Basic Editor.
- Copy the following code and paste it into the Module.
- Press the Run button or F5.
Sub UnwrapUsingVBA()
Range("D6:D13").WrapText = False
End Sub
The wrapped texts are unwrapped now.
Why Is the Wrap Text Feature Not Working in Excel?
There are many reasons for the wrap text feature not working in Excel. However, we have listed some common reasons why the issue occurs.
Reason 1: Fixed Row Height
If you manually set the Row Height of a cell, the Wrap Text feature will not work for that cell.
To demonstrate the issue, select range D6:D13 >> go to Home >> expand Format >> click on Row Height.
Due to this, the Row Height window will appear.
- Choose the desired height.
- Click OK.
Thus, we have manually set the Row Height. Now, choose the intended cells >> apply Wrap Text.
We will see that wrap text not showing all the text in cell, meaning the Wrap Text feature is not working.
However, the wrap text is cutting off words still.
Solution: Apply AutoFit Row Height
To overcome the situation, choose range D6:D13 >> go to Home >> expand Format >> click on AutoFit Row Height.
Lastly, you can see that the Auto Fit Row Height is used to wrap text in Excel cells.
Reason 2: Presence of Merged Cells
Another reason for the wrap text not working is the presence of merged cells. For example, in the image below, we applied Wrap Text to the merged cells of the Product Description column.
However, you can see that the texts are not visible, meaning the wrap text did not work.
Solution: Choose Either Wrap or Merge
Since the wrap text option does not work on merged cells, you can either apply the merging or wrap text options. You need to decide to choose one option.
However, you can apply both options with some extended steps. For that, follow the method that we explained before in this article: How to Wrap Text in Merged Cells in Excel.
Reason-3: Horizontal Alignment Set to Fill
Another reason for the wrap text not working is the horizontal alignment being set to Fill. The image below shows that the Wrap Text option is enabled. Yet the texts are not wrapped.
Let us check the horizontal alignment of these cells. For that, select the cells and press Ctrl+1.
This will open the Format Cells dialog box. Click on the Alignment tab. You can see in the Text Alignment section that the option for Horizontal is set as Fill.
Solution: Set Horizontal Alignment to General
To fix this problem, click the drop-down beside the Horizontal text alignment option and select General. Then press OK.
Finally, the wrap text option is enabled with the change of horizontal text alignment.
Which Things You Have to Keep in Mind?
While going through this article, there are a few things you should keep in mind.
- Opening the mentioned practice workbook side by side is recommended when going through this article.
- When working with large data, you should avoid manual wrapping.
- If you want to use Excel VBA code, save the workbook as macro-enabled.
Download Practice Workbook
Wrap Text in Excel : Knowledge Hub
I hope the article will help you with everything you need about wrapping text in Excel. Apply wrap text in Excel using Format Cells or VBA for large datasets. Besides, you can use the Wrap Text option or shortcut keys to wrap text within a small data set quickly. Here, you also learned to handle common problems related to wrapping text. Do not hesitate to leave a comment if you have any queries.
<< Go Back to Text Formatting | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!