ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Settign a Maximum and Minimum Row Height (https://www.excelbanter.com/excel-worksheet-functions/250829-settign-maximum-minimum-row-height.html)

Stephen

Settign a Maximum and Minimum Row Height
 
I'm trying to format my spreadsheet to accomadate a minimum row height, but
be able to expand to my largest section.

Eg. I want to have my minimum row height as 51, but if the text requires
more space then that, it will allow the cell to expand to that height.

Rick Rothstein

Settign a Maximum and Minimum Row Height
 
You will need VBA code to do that; something like this maybe...

Sub AutoFitRowHeightWhenNecessary()
Dim R As Range
Dim CurrentHeight As Double
Const MinRowHeight As Double = 51
On Error GoTo Whoops
Application.ScreenUpdating = False
For Each R In Worksheets("Sheet1").UsedRange.Rows
R.AutoFit
If R.RowHeight < MinRowHeight Then
R.RowHeight = MinRowHeight
End If
Next
Whoops:
Application.ScreenUpdating = True
End Sub

--
Rick (MVP - Excel)


"Stephen" wrote in message
...
I'm trying to format my spreadsheet to accomadate a minimum row height,
but
be able to expand to my largest section.

Eg. I want to have my minimum row height as 51, but if the text requires
more space then that, it will allow the cell to expand to that height.




All times are GMT +1. The time now is 06:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com