Calc: Autofit the height of the merged cell with a macro
Posted: Fri Mar 26, 2021 9:49 pm
There are very long names, and the column width is limited.
The situation with the "unpopular" data storage on the sheet is the merging of cells. Yes, this should be avoided.
Such data cannot be further processed. But sometimes you don't have to. We store it as we print it.
We need to make data storage compact and that's it.
The problem is that after merging the cells, such a merged cell itself does not expand the height, and this must be done manually.
You need a macro that, after editing the data in the cell, will do something like this:
- cancel the merging of cells (the data will end up in the top cell);
- auto-adjust the height of the row of the data cell and remembers the resulting height;
- merge the cells back together and... do something so that the row height of the merged cells in the sum is equal to the previously saved value (how to divide the heights of the rows that make up the combined row is an open question: equally or otherwise).
Perhaps there is a ready-made solution...
With combined columns, there is no need to do such manipulations (combining and editing data in columns is a rarer case).
If there is such a macro for LO Calc, please share it...
UPD: VBA
The situation with the "unpopular" data storage on the sheet is the merging of cells. Yes, this should be avoided.
Such data cannot be further processed. But sometimes you don't have to. We store it as we print it.
We need to make data storage compact and that's it.
The problem is that after merging the cells, such a merged cell itself does not expand the height, and this must be done manually.
You need a macro that, after editing the data in the cell, will do something like this:
- cancel the merging of cells (the data will end up in the top cell);
- auto-adjust the height of the row of the data cell and remembers the resulting height;
- merge the cells back together and... do something so that the row height of the merged cells in the sum is equal to the previously saved value (how to divide the heights of the rows that make up the combined row is an open question: equally or otherwise).
Perhaps there is a ready-made solution...
With combined columns, there is no need to do such manipulations (combining and editing data in columns is a rarer case).
If there is such a macro for LO Calc, please share it...
UPD: VBA