ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   AutoFit Visible Rows (https://www.excelbanter.com/excel-programming/375382-autofit-visible-rows.html)

Sisilla[_2_]

AutoFit Visible Rows
 
Hello All,

I would like to resize the rows to AutoFit the data when some columns
are hidden on my worksheet. (Some columns contain cells with a lot more
line breaks than others and cause the associated rows to be quite tall.
When these columns are hidden I would like the rows to be resized to
fit the cells without line breaks.)

SpecialCells(xlCellTypeVisible).Rows.AutoFit

resizes the rows to the tallest cell in the row whether that cell's
column has been hidden or not.

Is there any way to do what I am trying to do? I appreciate any help.

Thanks!
Sisilla


Sisilla[_2_]

AutoFit Visible Rows
 
Bump

Sisilla wrote:
Hello All,

I would like to resize the rows to AutoFit the data when some columns
are hidden on my worksheet. (Some columns contain cells with a lot more
line breaks than others and cause the associated rows to be quite tall.
When these columns are hidden I would like the rows to be resized to
fit the cells without line breaks.)

SpecialCells(xlCellTypeVisible).Rows.AutoFit

resizes the rows to the tallest cell in the row whether that cell's
column has been hidden or not.

Is there any way to do what I am trying to do? I appreciate any help.

Thanks!
Sisilla



Dave Peterson

AutoFit Visible Rows
 
You could copy the visible cells to a new temporary worksheet and autofit
there. Then use those rowheights to adjust the original row heights.

Sisilla wrote:

Hello All,

I would like to resize the rows to AutoFit the data when some columns
are hidden on my worksheet. (Some columns contain cells with a lot more
line breaks than others and cause the associated rows to be quite tall.
When these columns are hidden I would like the rows to be resized to
fit the cells without line breaks.)

SpecialCells(xlCellTypeVisible).Rows.AutoFit

resizes the rows to the tallest cell in the row whether that cell's
column has been hidden or not.

Is there any way to do what I am trying to do? I appreciate any help.

Thanks!
Sisilla


--

Dave Peterson

Sisilla[_2_]

AutoFit Visible Rows
 
Great idea, Dave! I'll try it out. Thanks!

Dave Peterson wrote:
You could copy the visible cells to a new temporary worksheet and autofit
there. Then use those rowheights to adjust the original row heights.

Sisilla wrote:

Hello All,

I would like to resize the rows to AutoFit the data when some columns
are hidden on my worksheet. (Some columns contain cells with a lot more
line breaks than others and cause the associated rows to be quite tall.
When these columns are hidden I would like the rows to be resized to
fit the cells without line breaks.)

SpecialCells(xlCellTypeVisible).Rows.AutoFit

resizes the rows to the tallest cell in the row whether that cell's
column has been hidden or not.

Is there any way to do what I am trying to do? I appreciate any help.

Thanks!
Sisilla


--

Dave Peterson




All times are GMT +1. The time now is 06:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com