Set Row height by character count

Brian F

Active Member
Joined
Aug 31, 2009
Messages
256
I want to set the row height on the basis of the character count in one cell.

The worksheet uses one very important cell that is merged (so the row height does not adjust automatically) and this is the cell I need to set the row height to accommodate.

I can get the number of characters using "LEN".
The row height can be specified by "Selection.RowHeight ="
Then it seems like some "IF" statements or "CASE" manipulations
So, if the character count is between 0 and 50, make the row height 20,
if it is between 50 and 100, make the row height 40 etc. I can determine acceptable parameters by trial and error.

I am envisioning that this would be activated by a form button for the time being.
Once I can do it for one row I'll figure out how to make it progress through the 35 rows of the worksheet as part of another VBA routine.

Help is always appreciated!
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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