VBA Code: Autofit Row Heights & Wrap Text With Merged Ce

otrevino3

New Member
Joined
Jan 25, 2005
Messages
22
The row heights from row 40 down to the end of my data range need to be autofitted. My Data range stops at around row 50.

The contents of rows 40 to end of range also need to be formatted with wrap text.

**Rows 40 down contain merged cells (i.e b40:d40 are merged; f40:h40 are also merged).**

Tactps posted some VBA that I tweeked a little, but after playing with it, I ended up with row 40 being sized to 12.75.

Here is the Tactps' raw VBA

Private Sub Worksheet_Calculate()
[a1].RowHeight = (Int((Len([a1]) / 30)) + 1) * 12.75
End Sub

Are there any VBA gurus out there that can help me tweek this VBA? I'd prefer not to unmerge all of these cells (there are quite a few).
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,214,414
Messages
6,119,375
Members
448,888
Latest member
Arle8907

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