Apr 05 2021 01:47 AM
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.
Apr 05 2021 03:00 AM
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?
Apr 05 2021 03:15 AM
Apr 05 2021 03:38 AM
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?
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.
Apr 05 2021 03:49 AM
Apr 05 2021 04:06 AM
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.
Apr 05 2021 04:25 AM
Merged cells cause a lot of problems in Excel VBA. One can work around them, but it's a pain in the behind... :(
Apr 05 2021 04:31 AM
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.
Apr 05 2021 04:46 AM
Apr 05 2021 05:07 AM
Aug 20 2021 10:12 PM
Please use Excel add-in "AutoFitRowEx".
This add-in will solve the issue.
[Github - Releases · toowaki/AutoFitRowEx]