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

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
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,214,945
Messages
6,122,397
Members
449,081
Latest member
JAMES KECULAH

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