How to Wrap Text in Excel (Wrap, Unwrap, Fix Issues)

Method 1 – Using Wrap Text Option from Home Tab

  • Select range D6:D13.
  • Go to the Home tab.
  • Click on Wrap Text in the Alignment group.

Selecting cells and choosing wrap text option

Text wrapped in the selected cells


Method 2 – Using Format Cells Dialog Box

  • Select the desired range (e.g., D6:D13).
  • Press Ctrl+1 to open the Format Cells dialog box.

Press Ctrl+1 after selecting the cells

  • Go to the Alignment tab.
  • Check Wrap Text under Text Control and click OK.
Notes
When the Wrap Text checkbox is filled with a solid rectangle box, it means that some of the selected cells are already wrapped. And some cells are not wrapped.

Choose wrap text option from alignment tab

Text wrapped in the selected cells


Method 3 – Using Keyboard Shortcut

You can easily apply the wrap text command using a shortcut key in Excel:

  • Select the range D6:D13.
  • Press Alt+H.

Select cells, press Alt and then H

  • Then press W to apply Wrap Text.

Press w

Text wrapped in the selected cells


Method 4 – Using AutoFit Column Width Option

To display the entire text inside a cell, follow these steps:

  • Select the cells where you want to wrap text (e.g., D6:D13).
  • Go to the Home tab.
  • Expand the Format option from the Cells group.
  • Choose AutoFit Column Width.
Choosing Autofit Column Width Option

Click the image to get a better view

Columns Autofitted

Click the image to get a better view

Notes
Keep in mind that the maximum column width is 255, so this method won’t work for text that exceeds this limit.

How To Wrap Text Manually in Excel

Insert Line Breaks to Manually Wrap Text

You can manually wrap text by inserting line breaks. Although this method takes longer, it can be useful in specific cases:

  • Select a cell and go to the Formula bar.
  • Place the cursor where you want to insert a line break.
  • Press Alt+Enter.

Place cursor and press Alt+Enter

  • After inserting the line breaks, press Enter.

Now, if you select cell D6, you’ll see that the Wrap Text feature is enabled.

Wrap Text Option Activated Automatically

You can apply the same format to other cells using Format Painter.

  • Select cell D6.
  • Go to Home >> click on Format Painter.

Selecting Format painter option

  • Select the range D7:D13 to apply the same format as D6.

Select Range to Paint Format

We have applied the Wrap Text feature manually.

Line break added

Removing Manual Line Breaks

To remove manual line breaks:

  • Place the cursor where a new line starts.
  • Press Backspace to remove line breaks one by one.

If you need to remove line breaks from multiple cells at once:

  • Select the intended cells and press Ctrl+H.
  • In the Find and Replace window, place your cursor in the Find what section and press Ctrl+J.
  • Keep the Replace with section empty and click Replace all.

Differences Between Wrap Text Feature and Line Breaks

There’s an interesting difference between the Wrap Text feature and line breaks:

  • Applying the Wrap Text feature directly in a cell displays the whole text in a single line within the formula bar.

Characteristic of Wrap Text Option

  • Using line breaks won’t show the entire text within the formula bar; you’ll need to expand it to see the full content.

Click the image to get a better view

Characteristic of Line Break

Click the image to get a better view

Notes
If you want to see the whole content after applying the Line Breaks in a cell, you must expand the formula bar.

Expanding formula bar to see whole text with line break

Click the image to get a better view


How to Wrap Text Using Excel VBA

We will use Excel VBA wrap text to wrap text in cells, ranges, rows, columns, or entire worksheets:

1. Wrapping Text in a Cell

  • Activate the intended sheet.
  • Go to Developer and click on Visual Basic.

Selecting Visual basic Option

Inserting Module

  • Insert the following code in a Module and run it:
Sub WrapCell()
    Cells(6, 4).WrapText = True
End Sub

WrapCell Code

Notes

Alternatively, you can use this 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 (e.g., D6:D13)

  • Activate the intended sheet.
  • Navigate to Developer and click on Visual Basic.

Selecting Visual Basic Option

Inserting Module

  • Insert the following code in a module and run it:
Sub WrapRange()
    Range("D6:D13").WrapText = True
End Sub

WrapRange Code

Now you have successfully enabled the Wrap Text feature for the specified cell range!

Wrapping Text in Range


3. Wrapping Text in Selected Range

To apply the wrap text feature to a selected range, follow these steps:

  • Select the range D6:D13.
  • Go to the Developer tab and click on Visual Basic.

Selecting Visual basic Option

Inserting Module

  • In the VBA Editor window, insert the following code in a new module:
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

WrapSelectedrange Code

  • Now you’ll see that the Wrap Text feature is enabled for the selected range.

Wrapping text in Selected range


4. Wrapping Text in Used Range

  • Go to the Developer tab and click on Visual Basic.

Showing Used Ranges and selecting visual basic

Inserting Module

  • In the VBA Editor window, insert the following code in a new module and run it:
Sub WrapUsedRange()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("In Used Range (VBA)")
    ws.UsedRange.WrapText = True
End Sub

WrapUsedRange Code

  • Select any cell within the Used Range, and you’ll see that the Wrap Text feature is enabled.

Used ranges text wrapped


5. Wrapping Text in Entire Row (e.g., row 6)

Showing the 6th row

  • Open the VBA Editor.
  • Click on Insert and choose Module.
  • Insert the following code and run it:
Sub WrapEntireRow()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("In Entire Row (VBA)")
    ws.Range("6:6").WrapText = True
End Sub

WrapEntireRow Code

Notes

Make sure to adjust the sheet name (“In Entire Row (VBA)”) in the code to match your workbook.

You can see that the text in Row 6 is wrapped.

Showing entire row is wrapped


6. Wrapping Text in Entire Column (e.g., Column D)

Showing the Column

  • In the Visual Basic Editor window, click on Insert and choose Module.
  • Paste the following code and run it:
Sub WrapEntireColumn()
    Range("D:D").WrapText = True
End Sub

WrapEntireColumn

  • Insert long text within any cell of Column D to see the result.

Text Wrap Activated for the entire column


7. Wrapping Text in Entire Worksheet

  • Open the VBA Editor.
  • Click on Insert and choose Module.
  • Insert the following code and Run it.
Sub WrapEntireWorksheet()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("In Entire Worksheet (VBA)")
    ws.Cells.WrapText = True
End Sub

WrapEntireWorksheet Code

  • Select any cell within that sheet to verify that the Wrap Text feature is enabled.

Select any cell and you will see wrap text enabled for that cell

You can also loop through all sheets in a workbook and apply Wrap Text using the following code:

Sub WrapAllWorksheets()
    Dim ws As Worksheet
    For Each ws In ActiveWorkbook.Worksheets
       Cells.WrapText = True
    Next ws
End Sub

WrapAllWorksheets code


8. Wrapping Text in Non-contiguous Range

Showing Non-contiguous Cells

  • Go to Developer >> Visual Basic.
  • Click on Insert >> Module.
  • Paste the following code and Run it.
Sub WrapNoncontiguousRange()
    Range("D6:D13,C16:C17").WrapText = True
End Sub

WrapNonContiguousRange Code

  • Now you’ll see that Wrap Text is enabled for the D6:D13 and C16:C17 ranges.

Wrap text enabled all non-contiguous cells


9. Wrapping Text in Named Range

  • Select the D6:D13 range and type Product Description in the Name Box to create a Named Range.

Naming the selected range

  • Insert a Module in Visual Basic Editor.
  • Then, insert the following code and Run it.
Sub WrapUsedRange()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("In Used Range (VBA)")
    ws.UsedRange.WrapText = True
End Sub

WrapNamedrange Code

The Wrap Text feature will now be applied to the Named Range.

Wrap Text enabled in Cells of Named Range


How to Wrap Text in Merged Cells in Excel

When dealing with merged cells in Excel, wrapping text becomes essential to ensure that all content is visible. Follow these steps to wrap text in merged cells:

Showing Merged Cells

Click the image to get a better view

  • Select the Merged Cells:
    • Identify the merged cells where you want to wrap the text (e.g., cells in the “Product Description” column).
    • Right-click on the selected merged cells to open the context menu.
  • Format Cells:
    • Click on Format Cells from the context menu.
Selecting Format Cells Option-46

Click the image to get a better view

    • The Format Cells dialog box will appear.
  • Enable Text Wrapping:
    • In the Format Cells dialog box, navigate to the Alignment tab.
    • Check the Wrap text box under the Text control section.
    • Click OK to apply the changes.

Selecting Wrap Text Option-47

  • Adjust Row Height:
    • By default, the wrapped text may not be fully visible due to the row height.

 

Wrap text enabled but texts not visible-48

Click the image to get a better view

    • Select the cells (e.g., D6:D13) containing the wrapped text.
    • Go to the Home tab and expand the Format option.
    • Choose Row Height under Cell Size.
Selecting Row Height Option

Click the image to get a better view

    • Set Row Height to 45 to ensure the wrapped text is fully visible.
    • Press OK.

Setting Row Height-50

Now you’ll be able to see all the wrapped texts in the merged cells.

Selected Cells row height changed-51


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

To remove text wrapping (i.e., unwrap text) in Excel, consider the following methods:

Method 1 – Deselect Wrap Text Option

  • Select the intended cells.
  • Go to the Home tab.
  • Deselect the Wrap Text option.

Deselecting wrap text option

  • This will revert the text to its original single-line format.

Texts Unwrapped


Method 2 – Use Format Cells Window

  • Right-click on any selected cell.
  • Choose Format Cells.
Selecting Format Cells Option

Click the image to get a better view

  • In the Format Cells window, go to the Alignment tab.
  • Uncheck Wrap Text under Text Control.
  • Click OK.

Deselecting Wrap Text Option

Now you’ll be able to see all the wrapped texts in the merged cells.

Texts Unwrapped


Method 3 – Apply a Keyboard Shortcut

  • Select the desired cells.
  • Press Alt+H+W to remove text wrapping.

Select Cells and press Alt+H+W

As a result, the output will look like this:

Texts Unwrapped


4. Using Excel VBA

If you prefer automation, use VBA (Visual Basic for Applications):

  • Go to the Developer tab and select the Visual Basic option.

Selecting Visual Basic Option

  • Insert a Module in Visual Basic Editor.

Inserting Module

  • For example, to unwrap text in range D6:D13, insert the following code in a module:
Sub UnwrapUsingVBA()
Range("D6:D13").WrapText = False
End Sub

UnwrapUsingVBA Code

  • Run the code by pressing the Run button or F5.

The wrapped text is unwrapped now.

Unwrapped Text


Why Is the Wrap Text Feature Not Working in Excel?

There are common reasons why the Wrap Text feature may not work as expected:

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 resolve this, select range D6:D13 >> go to Home >>Format >> Row Height, and choose an appropriate height.
Selecting Row Height Option

Click the image to get a better view

Setting row height-63

  • Alternatively, use AutoFit Row Height to adjust the row height automatically.

Reason 2: Presence of Merged Cells

Wrap Text to Merged Cells

Wrap text not working-69


Reason 3: Horizontal Alignment Set to Fill

Another factor that can prevent text wrapping from working is the horizontal alignment being set to Fill. Even if the Wrap Text option is enabled, the text won’t wrap properly.

Wrap Text not working

To address this issue:

  • Select the cells where you want text wrapping to work.
  • Press Ctrl+1 to open the “Format Cells” dialog box.

Press Ctrl+1 after selecting cells

  • Go to the Alignment tab.
  • In the Text Alignment section, check the horizontal alignment setting.
  • If it’s set to Fill, change it to General.
  • Click OK to apply the changes.

Showing Horizontal Alignment set to Fill

By adjusting the horizontal alignment to General, you’ll ensure that text wrapping functions correctly.


Which Things You Have to Keep in Mind?

While going through this article, there are a few things you should keep in mind.

  • Consider opening the practice workbook alongside this article for reference.
  • Avoid manual wrapping when dealing with large datasets.
  • If you plan to use Excel VBA code, save the workbook as a macro-enabled file.

Download Practice Workbook

You can download the practice workbook from here:


Wrap Text in Excel: Knowledge Hub


<< Go Back to Text Formatting | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Priti
Priti

Priti Halder holds a BSc degree in Naval Architecture and Marine Engineering from Bangladesh University of Engineering and Technology. She has been a part of the ExcelDemy project for 6 months and during this time, she has written over 30 articles and 5 comments for the platform. Priti is currently employed as an Excel and VBA content developer and provides effective solutions to various Excel-related issues. She is passionate about expanding her knowledge of data analysis and Microsoft... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo