AutoFit row height in multiple merged cells

GingerCoder

New Member
Joined
Feb 2, 2018
Messages
5
Hello,
I have a spreadsheet where based on what value is input, certain cells are hidden. Most all of my rows contain merged cells. I am looking for a code that will autofit my merged cells and still allow them to be hidden based on other code. I found a code where the autofit works, but the rows do not hide based on the other code...i.e.

Range("D5:H5").Rows.AutoFit
Range("B9:N9").Rows.AutoFit
Range("B12:N12").Rows.AutoFit
Range("B15:N15").Rows.AutoFit
Range("D28:N28").Rows.AutoFit
Range("D48:N48").Rows.AutoFit

Suggestions?
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
I have been able to use a combination of the above and a method that goes around the issue. Basically, I went to column Z and made it the same width as whatever merged cell I wanted then made that cell equal my merged cell and formatted the cell in column z to autofit the height.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top