AutoFit Visible Rows

S

Sisilla

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
 
D

Dave Peterson

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

Sisilla

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top