Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. 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 June 21, 2018)

15

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.

You can find additional information about this issue in the Microsoft Knowledge Base:

http://support.microsoft.com/?kbid=149663

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 CL As Range

    For Each CL In UsedRange
        If CL.WrapText Then CL.Rows.AutoFit
    Next
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, and 2013. 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

Using Different Colors with Tracked Changes

When changes are made in a document with Track Changes turned on, each author's changes are normally shown in a different ...

Discover More

Introducing the Organizer

The Organizer is a great tool for, well, organizing the information stored in your templates. This tip introduces the ...

Discover More

Zooming with the Keyboard

Want to zoom in and out without the need to using the ribbon tools? You can create your own handy macros that do the ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling 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

Hiding a Huge Number of Rows

Need to hide a large number of rows? It's easy to do if you combine a few keyboard shortcuts. Here are several techniques ...

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
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 3 - 3?

2017-09-19 14:32:15

Evee

Thank you so much!


2017-09-19 14:18:14

Andy Wahl

I have Excel 2016 and the code below actually made the row only one line in height. maybe because I have a formula in the cell

Sub AutofitRows()
Dim CL As Range

For Each CL In UsedRange
If CL.WrapText Then CL.Rows.AutoFit
Next
End Sub


2017-07-20 18:25:50

Peter

Gadi

The Link works for me. Just double-clicked the URL


2017-07-17 16:43:46

Gadi

Row height auto-fit is definitely the key in order to make the text wrap work wherein it doesn't work. The code is nice but not applicable for a range which keeps expanding over time (unless you wish to run this code after every blank cell receives a value). Assuming you need the text wrap to work specifically in a certain column or a designated range, select an entire column or your range then in Office Ribbon >>> Home tab >>> Format >>> AutoFit Row Height

This method would accommodate any future text wrapping in cells which are currently not filled yet with any data.

Allen - The link to Microsoft website is dead...


2017-07-14 08:18:13

Tim D

Great Code .. Worked GREAT on individual sheets, however received an error when applied to the Workbook level.

I also got the Run-time error 424 "Object required" when running the macro in Excel 2016 at the Workbook level, however works well when assigned under each sheet.

I'm a moderate with VB & VBA but learning quickly!

I use your site regularly and finally signed up for the newsletter!

Thank you for your great advice, code and help!


2016-10-06 10:46:20

James L.

Great code Allen! Can this be automated somehow so that I don't have to manually run it?


2016-09-13 12:45:45

Willy Vanhaelen

@James

Change: For Each CL In UsedRange
to: For Each CL In ActiveSheet.UsedRange


2016-09-12 08:59:12

James

I receive the same error message as Jason,

Run-time error 424 "Object required"


2016-06-05 22:24:24

B.J. Winzer

Found another thing that stops text from wrapping: Conditional Formatting. (In Excel 2010 this is definitely the case.)

Conditional formatting prevents other basic formatting, e.g. vertical alignment of cells. It twigged after a while that it might be stopping text from wrapping too. Removed it, bingo, text is wrapping again.

PS: The macro in the post didn't work for me either.


2016-02-08 15:57:39

Richard Mills

I found another things that causes this. If you go into Excel Options, Advanced, check the "Show formulas in cells instead of their calculated results" checkbox. If it is checked, you will get this extra space in cells. And if it is a sheet without formulas, you may not notice this box is checked.


2016-01-25 14:22:20

Allen

Jim: the sign-up form is at the right side of any page, including this one.

-Allen


2016-01-25 12:51:47

Jim

Please sign me up for your email newsletter. Thank you for your help!


2015-10-30 07:58:10

Jason

I keep getting Run-time error 424 "Object required" when running the macro in Excel 2010.

The line of code that seems to be at fault here is "For Each CL In UsedRange"


2015-10-11 21:30:35

Keith

Hey, AWESOME work! I finally found a computer help site that I can actually understand. Instead of trying to show us how brainy he is, Allen shows how us simple Excel can be! Very very appreciated and very very BOOKMARKED!!!!


2015-09-22 12:12:19

Teacher

Perfect! Thanks


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.