Seeking Code / Macro to Edit Row Height

ProphetYxez

New Member
Joined
Nov 12, 2024
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
I piece together weekly reports for my team.
I keep row heights at a minimum 75.00, 100 pixels and maximum 203.25, 271 pixels.
To take a lot of time out of this task and make it automated, I would like to conditionally format (though probably not possible based on my research) or enter a code / macro that will do the following:

If row height < 100 pixels, make 100 pixels (or input 75 for "100", however Excel will understand)
If row height > 271 pixels, make 271 pixels (or input 203.25 for "271", however Excel will understand)

MANY thanks in advance
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
VBA Code:
Sub do_it()
For r = 2 To 50 'adjust as needed
    If Rows(r).RowHeight < 100 Then Rows(r).RowHeight = 100
    If Rows(r).RowHeight > 271 Then Rows(r).RowHeight = 271
Next r
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,701
Messages
6,173,920
Members
452,539
Latest member
deeme

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