Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Automatic Row Height for Wrapped Text.

Automatic Row Height for Wrapped Text

by Allen Wyatt
(last updated October 31, 2020)

3

Jordan formatted some cells in his worksheet to wrap text within them. Even though the text in the cells wraps, Excel won't automatically adjust the row height to show all the wrapped text. Jordan wonders if there is a way to "reset" the row so that Excel will adjust its height based on the text being wrapped within the cells.

By default, when you wrap text within a cell, Excel automatically adjusts row height so that all the text in the cell is visible. There are only two exceptions to this default:

  • The cell in which you are wrapping text is actually merged with another cell.
  • The height of the row in which the cell is located was previously changed.

In Jordan's case, there are no merged cells in the problem row. This leaves us with the second exception—it would appear that the height of the row in which the cell is located was explicitly set before wrapping was turned on in some of the row's cells.

In this case, the solution is simple: Reset the row height. There are actually a couple of ways you can do this. First, you could select the row and then double-click the "boundary" between the row and an adjacent row. With the row selected, take a look at the row header, to the left of column A. This area contains a row number, and the "boundary" you need to double-click is between this row number and the next row number.

It can be a bit tricky to get the mouse pointer in the correct location to do the double-clicking, so an approach I prefer is to select the row and display the Home tab of the ribbon. In the Cells group there is a Format tool; I click it and then choose AutoFit Row Height. This allows Excel to determine the appropriate row height based on the contents of the row. If a cell in the row has wrapping turned on, then the row height will automatically adjust to display the information in the cell.

If you have quite a few rows that contain cells with wrapping turned on, and the height of none of the rows is adjusting, then you may be interested in a quick little macro that can do the adjustment for you:

Sub AutofitRows()
    Dim c As Range

    For Each c In ActiveSheetUsedRange
        If c.WrapText Then c.Rows.AutoFit
    Next c
End Sub

The macro steps through all the cells in a worksheet, and if the cell has wrapping turned on, it sets the AutoFit property of the row in which the cell is located.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10735) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. You can find a version of this tip for the older menu interface of Excel here: Automatic Row Height for Wrapped Text.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Combining Documents

Need to combine quite a few text documents? A macro may be the easiest way to stuff them all into a single Word document.

Discover More

Getting Rid of "Comment" in Comments

When you add a comment to a document, Word presents that comment in a very specific way. If you want to change the way in ...

Discover More

Duplicate Workbooks Opening

If you ever open a workbook and always see two workbooks instead of one, chances are good the reason is because of the ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Adjusting to a Maximum Row Height

Need to check the height of all the rows in a worksheet and then adjust them if a particular criterion is met? This tip ...

Discover More

Increasing Row Height for Printing

You may have a need to increase the height of the rows in your worksheet to "spread out" the data when it is printed. ...

Discover More

Detecting Hidden Rows

Excel allows you to easily hide rows in a worksheet, so their contents are not visible. Figuring out how to detect where ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is seven more than 0?

2020-11-03 13:11:51

william driskell

shortcut - if you click in upper left corner of the sheet's margin to "select entire sheet," then click any row's upper/lower edge in the left margin, you will auto-adjust the entire sheet instead of a single row.
I usually like to auto-adjust all row heights after widening a column for some awkwardly wrapped text content. Must be some pysch phenomena but I find it easier to visually scan through data when they're all in similar cells --or maybe it's just OCD showing up in formatting...


2020-11-01 07:43:44

Ron S MVP

I've since tweaked the macro some more to now apply the WrapText attribute.

Sub AutoFitRowHeight()
' https://excelribbon.tips.net/T010735_Automatic_Row_Height_for_Wrapped_Text.html
'
' Select the area to be affected
' Loop through all rows in current sheet, turn on AutoFit Row Height attribute
' Turn on Wrap attribute to resize rows
'
Dim c As Range

For Each c In ActiveSheet.UsedRange
If c.WrapText Then c.Rows.AutoFit
Next c

With Selection
.WrapText = True
End With

End Sub

I tried adding c.Rows.WrapText=True inside the "IF", but it didn't work. I had to move as above.


2020-10-31 10:30:13

Ron S MVP

Oops, typo:
For Each c In ActiveSheetUsedRange

Should be:
For Each c In ActiveSheet.UsedRange

This is definitely something I didn't know I needed. But now that I have it, it is on my QAT now and I'll be using it, A LOT!


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.