Wrap text
How to fit content in a cell without adjusting column width using Excel and VBA methods
Select the cell in which to wrap text > Home tab > Alignment group > Wrap Text
1. Select the cell in which you want to wrap text. Note: in this example cell B2 contains a long text string that we are wrapping. |
2. Select the Home tab. |
3. Click on Wrap Text, in the Alignment group. |
Right-click on the cell in which to wrap text > Format Cells > Alignment tab > Check Wrap text checkbox > Click OK
1. Right-click on the cell in which you want to wrap text. 2. Select Format Cells. |
3. Select the Alignment tab. 4. Check the Wrap text checkbox. 5. Click OK. |
METHOD 1. Wrap text using VBA
VBA
Sub Wrap_Text()
'wrap text in cell B2 in worksheet named Sheet1
Worksheets("Sheet1").Range("B2").WrapText = True
Worksheets("Sheet1").Range("B2").WrapText = True
End Sub
PREREQUISITES
Worksheet Names: Have a worksheet named Sheet1.
Worksheet Names: Have a worksheet named Sheet1.
ADJUSTABLE PARAMETERS
Sheet Selection: Select the worksheet in which you want to wrap text by changing the Sheet1 worksheet name in the VBA code.
Wrap Text Cell Selection: Select the cell in which you want to wrap the text by changing the cell reference ("B2") in the VBA code.
Sheet Selection: Select the worksheet in which you want to wrap text by changing the Sheet1 worksheet name in the VBA code.
Wrap Text Cell Selection: Select the cell in which you want to wrap the text by changing the cell reference ("B2") in the VBA code.
METHOD 2. Wrap text in selected cells using VBA
VBA
EXPLANATION
This tutorial explains and provides step by step instructions on how to wrap text.
This tutorial explains and provides step by step instructions on how to wrap text.
Excel Methods: This tutorial provides two Excel methods that can be applied to wrap text. Both of the methods are very similar to each other, with one using the Home tab and the other using the Format cells option. The first method can be accomplished in three steps, whilst the second in five steps.
VBA Methods: This tutorial provides two VBA methods that can be applied to wrap text. The first method wraps text in the cells specified in the VBA code. The second method wraps text the selected cells.
RELATED TOPICS
Related Topic | Description | Related Topic and Description |
---|---|---|
Unwrap text | How to unwrap content in a cell using Excel and VBA methods | |
Merge cells | How to merge cells using Excel and VBA methods | |
Unmerge cells | How to unmerge cells using Excel and VBA methods |