Problem with row heights

User avatar
ErikJan
BronzeLounger
Posts: 1252
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Problem with row heights

Post by ErikJan »

I know there's probably not a good answer for this one but maybe someone has an idea...

I have a sheet where I have hidden certain columns. For the visible part of the sheet I want to 'autofit' the row-height. VBA autofit didn't seem to work, neither did the manual double click on the row border. It turns out that Excel still takes the hidden columns into account when I try to autofit. As some of the hidden cells have more text, they are 'higher' and in the visible part that leads to white unused areas in the visible cells. Is there anything i could (programmatically) simply do in VBA to go fix that somehow?

User avatar
HansV
Administrator
Posts: 78512
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Problem with row heights

Post by HansV »

I think the only way to do that would be:
- Create a copy of the sheet.
- Delete the hidden columns.
- Autofit the row heights.
- Set the row heights of the original sheet to those of the copy.
- Delete the copy.

Probably more work than it's worth...
Best wishes,
Hans