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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,221,525
Messages
6,160,326
Members
451,637
Latest member
hvp2262

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