Row adjust not working for merged cells

%3CLINGO-SUB%20id%3D%22lingo-sub-2253762%22%20slang%3D%22en-US%22%3ERow%20adjust%20not%20working%20for%20merged%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2253762%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20using%20MS%20365%20v2102%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20is%20a%20%3CSTRONG%3Emerged%20cell%3C%2FSTRONG%3E%20that%20will%20contain%20a%20%3CSTRONG%3Elong%20text%3C%2FSTRONG%3E.%20Typically%20used%20for%20notes.%3C%2FP%3E%3CP%3EWhen%20I%20touch%20%22wrap%20text%22%2C%20the%20merged%20cell%20with%20long%20text%20only%20shows%20one%20line.%3C%2FP%3E%3CP%3EI%20manually%20make%20the%20row%20several%20lines%20tall.%20If%20I%20re-wrap%20it%20goes%20back%20to%201.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EWrap%20text%20is%20not%20working%20with%20merged%20cells.%20It%20assigns%20only%20a%20line%20tall.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%2C%20identify%20basic%20functionality%20issues%20first.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20tried%20a%20similar%20post%20for%202016%20but%20it%20is%20a%20different%20thing.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fexcel%2Fautofit-row-height-with-wrap-text-not-working-on-2016-excel%2Fm-p%2F2010036%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fexcel%2Fautofit-row-height-with-wrap-text-not-working-on-2016-excel%2Fm-p%2F2010036%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2253762%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2253848%22%20slang%3D%22en-US%22%3ERe%3A%20Row%20adjust%20not%20working%20for%20merged%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2253848%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F930198%22%20target%3D%22_blank%22%3E%40EduardoSR%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20is%20one%20of%20the%20many%20reasons%20you%20should%20avoid%20merging%20cells.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAre%20your%20cells%20merged%20horizontally%20(i.e.%20in%20a%20row)%2C%20or%20merged%20vertically%20(i.e.%20in%20a%20column)%2C%20or%20both%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2253870%22%20slang%3D%22en-US%22%3ERe%3A%20Row%20adjust%20not%20working%20for%20merged%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2253870%22%20slang%3D%22en-US%22%3EHorizontally%2C%20just%20one%20row.%20Maybe%20the%20problem%20is%20with%20all%20the%20merges.%20Haven't%20checked%3CBR%20%2F%3E%3CBR%20%2F%3EMerged%20cell%20have%20always%20been%20problematic%2C%20but%20anyway%20you%20still%20need%20them%20for%20formatting%3C%2FLINGO-BODY%3E
Occasional Contributor

 

I am using MS 365 v2102

 

There is a merged cell that will contain a long text. Typically used for notes.

When I touch "wrap text", the merged cell with long text only shows one line.

I manually make the row several lines tall. If I re-wrap it goes back to 1.

 

Wrap text is not working with merged cells. It assigns only a line tall.

 

Please, identify basic functionality issues first. 

 

 

I tried a similar post for 2016 but it is a different thing.

https://techcommunity.microsoft.com/t5/excel/autofit-row-height-with-wrap-text-not-working-on-2016-e...

10 Replies

@EduardoSR 

This is one of the many reasons you should avoid merging cells.

 

Are your cells merged horizontally (i.e. in a row), or merged vertically (i.e. in a column), or both?

Horizontally, just one row. Maybe the problem is with all the merges. Haven't checked

Merged cell have always been problematic, but anyway you still need them for formatting

@EduardoSR 

Does your text contain the line feeds (Alt/Enter or CHAR(10)) or are you relying on the cell width to generate the now line?

@Hans Vogelaar 

I find that, with dynamic arrays, merged cells trouble me less.  My source data would be held in Tables and the calculated values are all dynamic arrays.  I have very little need to make manual selections in regions outside these named objects, so I do not come into conflict with the merged cells to any great extent.  One use I have for merged cells, is to display the result of FORMULATEXT which, these days, may well run over 10 or more rows when using combinations of LAMBDA and LET.

I have tried both: plain text and plain text with Alt+Enters. No formulas nor dynamic arrays
None work in merged cells
Both work in single simple cells

@EduardoSR 

It should simply be a matter of whether the .wrap property of the range is set or not.  The VBA help shows:

This property returns True if text is wrapped in all cells within the specified range, False if text is not wrapped in all cells within the specified range.  Microsoft Excel will change the row height of the range, if necessary, to accommodate the text in the range.

 

The same applies whether you are accessing the setting via code or buttons on the user interface.  It seems that merged cells do not adjust the row heights to accommodate the text, though.  That has to be done manually.

 

@Peter Bartholomew 

Merged cells cause a lot of problems in Excel VBA. One can work around them, but it's a pain in the behind...

@EduardoSR 

If I use Center Across Selection instead of merging cells, Excel automatically fits the row height for me.

 

There is VBA code to autofit the row height of merged cells, but (a) it is complicated, (b) it works less than perfectly, and (c) it disables Undo.

I would also use 'Center across Selection' for centred headings, though it makes little difference to ones ability to select an Excel Table column since that does not accept entire column selections.
I wasn't proposing a VBA solution, I had simply used the object model as a source of information on the 'wrap' property. I hope I did not confuse the OP.
I understood you wanted to do some "reverse engineering via VBA" to find out a solution.

In my case the other centred options do no seem to work for me. In fact it is the same solution that was stated at the link.

@EduardoSR 

Please use Excel add-in "AutoFitRowEx".

This add-in will solve the issue.

 

[Github - Releases · toowaki/AutoFitRowEx]

https://github.com/toowaki/AutoFitRowEx/releases