Excel.Tips.Net ExcelTips (Menu Interface)

Automatic Row Height For Merged Cells with Text Wrap

Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Automatic Row Height For Merged Cells with Text Wrap.

Ernie asked if there was a way for Excel to automatically adjust the row height in cells that are merged. He points out that if a cell is set with text wrapping turned on, that Excel automatically adjusts the row height for the cell so that all the wrapped text is visible. If you subsequently merge that cell with an adjacent cell, even if the adjacent cell has text wrapping turned on, then the resulting merged cell's row height is not adjusted so that all the text is visible.

Exactly why Excel does this is unclear, but there is no intrinsic way around it—Excel just does it. At first blush you may think that you can use the AutoFit feature (Format | Rows | AutoFit) to adjust the height of the row in which the merged cell is located. Doing so, however, apparently has no affect—AutoFit seems to completely ignore merged cells in doing its magic.

One way around the problem is to use a macro to set the row height to the desired height. A good approach is to have the macro determine the column width of the merged area, unmerge the columns, set the first column to that width, and determine the row height required to AutoFit it. The macro could then reset the column width, merge the cells, and set the new row height. (If that sounds like a lot, it is. Such a macro wouldn't be that trivial to create.)

If you don't want to use a macro, you can fool Excel into setting the row height properly. You do this by using a separate column that is created for the express purpose of setting row height. The process is described in the following general steps. (These steps assume you are merging the cells in columns A and B, and that your data table only includes columns A through K.)

  1. Merge the cells in columns A and B as desired.
  2. In column Z (or some other column outside of your data table range, but not immediately adjacent), put a simple formula reference to column A, as in =A1.
  3. Ensure the text formatting of column Z is exactly the same as in the merged cell, with the exception of merging. (Column Z should not be merged with anything, nor should it be marked as merged.)
  4. Make the width of column Z slightly narrower than the combined width of columns A and B.

The effect of these steps is that Excel will set the row height based upon the contents of column Z, which just happen to match the contents of the merged cell in columns A and B. This, of course, allows all the text in the merged cell to be visible. The only thing you will need to do is make sure that you don't print the contents of column Z when you do your printing.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3207) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Automatic Row Height For Merged Cells with Text Wrap.

Related Tips:

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!


Leave your own comment:

  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*What is 5+3 (To prevent automated submissions and spam.)
           Commenting Terms

Comments for this tip:

Deborah    23 Jul 2016, 10:16
I can't believe this is still a thing. Thank you for the information. But since I am trying to create a standard doc that multiple people will be using, I don't think i will be able to make it work. Whats up excel?
Matt D    24 Feb 2016, 16:27
This is a great suggestion. Thank you so much!
Ricky K    19 Feb 2016, 05:11
Brilliant idea :D
It works for me.

1. Merge cells you want, example: A1,B1,C1
2. Copy content of merged cell (in this case A1) to an unused column (but in a row with merged cell) example Z1
3. Get the size of merged cell (A1), and then apply the width to Z1 manually
4. At Z1, apply Wrap Text(Alignment > Wrap Text)

Maybe most of you who fail haven't applied "Wrap Text" to Z1 (in example above)

Thanks a lot
ben    25 Nov 2015, 20:46
weird. it doesn't aut adjust the height after i type my info in but when i go back and delete what I had typed, then it adjusts to what would have been the right height. any thoughts?
margo    23 Oct 2015, 21:10
Doesn't work here either but I'm running 2010 Office for Mac2011 :(
DaViD    09 Oct 2015, 05:31
Thank so much
Nguy√™n    06 Sep 2015, 22:36
Unbeliverable, in 2015, it working.
Thank you very much
AJ    19 May 2015, 09:14
This sounds great and simple, but it is not working 2007 version.
JAugusto    25 Feb 2015, 13:59
Not working... Need to, manually, click on merge cell or wrap text. Excel 2013
Christi    12 Nov 2014, 09:18
Not working for me...
Mary Gouldin    11 Nov 2014, 13:28
Not working for me :(
Brooks    02 Jul 2014, 15:12
Thanks for the tip...but...I'm still very annoyed that this basic problem has been in MS Excel for sooo long, through a number of major releases, and STILL exists in Excel 2013 :(
Tom    06 May 2014, 08:27
Very clever and thank you indeed! It kills me that I did not think of it myself!
Carl    29 Apr 2014, 09:33
This is the BEST way to go WITHOUT using a macro. If anyone does not get how to use this in there spreadsheet send me an email and I will help you ... its that EZ
Eric    05 Mar 2014, 09:39
Brilliant workaround! Thanks
Johnny Lindulf    08 Apr 2013, 10:42
Great. Thanks to you and to Google to put you on the first page. Solves my problems.
I put it into a VBA loop to adjust the row heigts individually to each row from row_1 to row_n.
If you delete the assisting column afterwards, the row heigts will revert to standard height.
One Solution:
If you run through your rows a second time within the merged area and simply find the row height, put it into a variable and then set the row height to the value of the variable, the row heights will prevail.
'for each row, freeze the row heigt
    For r = row_1 To row_n
        Range("B" & r).Select
        rh = Selection.RowHeight
        Selection.RowHeight = rh
    Next r
Adam E    29 Mar 2013, 12:19
Quite ingenious, thanks so much for this tip!
Nees    22 Mar 2013, 14:43
I'm using Excel 2010 but the row height doesn't changes automatically. I have to double click the row seperator.
Katie    18 Feb 2013, 23:36
Thank you SO much! My manager wanted something that did not inolve VBA or macros, and this worked perfectly!!!
Dragan Bogdanovic    06 Dec 2012, 11:33
Thank You for my time!
Angela    28 Nov 2012, 16:55
Sounds like a tip that I can use! However, I'm unsure how to set it up. I have columns A-H merged on several different rows of which I need the text to wrap. I'm unsure how to write the reference and whether I need to write several references. Please advise. Thanks!
Dave    10 Oct 2012, 14:30
Good option, but doesn't seem to work if you use Alt+Enter to create new lines. Thanks.
Gabriel    09 Aug 2012, 11:53
This is a solutions for dummies like me. Simple nice and easy. Cheers, thank you very much.
Steffen    09 Aug 2012, 05:06
What a great (and actually simple) tip to solve the auto row height problem with merged cells in Excel. Thank you very much!!!
Gadi Bizinyan    10 May 2012, 16:11
Great tip, I'm sure a lot of users run into this issue one time or another. I wonder why this has never been fixed in the newer versions of Excel.

To Barb:
For each set of merged cells in a row, you have to make an additional column with a reference formula. For what you described, you'll need 5 reference columns.

It's very helpful if you trigger the row to expand with the Sheet_Change event. When you use the following line in your macro:
Rows(Target.Row & ":" & Target.Row).EntireRow.AutoFit
Excel will automatically adjust the row according to the cell that requires the largest row height.
Barb    10 Apr 2012, 21:15
Automatic Row Height For Merged Cells with Text Wrap

What if you have 10 columns (a,b,c,d,e,f,g,h,i,j) - (a&b merged, c&d merged, e&f merged, g&h merged, i&j merged). You will never know which one of the merged cells will have the most information in it. ie. 1 week e&f could have 3 lines of text, the second week a&b could have 4 lines of text. Can you have it automatically work out which merge has the most and conform the autofit to the height needed for that cell merge.
JGarrity    29 Mar 2012, 11:37
So simple, it's BRILLIANT!
Cathy    27 Feb 2012, 07:55
Ditto ^10
Thank you very much
C.P. Gardiner    15 Jan 2012, 15:59
THANK YOU, THANK YOU, very much indeed, for this tip! I just spent a frustrating morning trying to find a workaround.
This problem (failing to adjust line height automatically to display wrapped text in merged cell) is typical of the inability of Microsoft products to do a good job on text.
The problem does not occur in QuattroPro, the spreadsheet in WordPerfect Office, which handles text much better than Excel; and of course, WordPerfect is still superior to MS Word. Alas, I have to use Excel to produce some forms for a person who only has MS Office (preloaded, of course--that's how MS has come to dominate the market with inferior products!
Thank you also for listening to my rant!
Greg Olson    30 Nov 2011, 14:08
You are a genius. Excellent suggestion on working around Excel's limited merge wrap functions.
Paul    12 Nov 2011, 19:14
You are a damn genious, you have no idea how much this just helped me. Thank you

Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us


Advertise with Us

Our Privacy Policy

Our Sites


Beauty and Style




DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)



Home Improvement

Money and Finances


Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Our Products

Helpful E-books

Newsletter Archives


Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2017 Sharon Parq Associates, Inc.