Add padding to the top & bottom of a row height

gailb
3StarLounger
Posts: 254
Joined: 09 May 2020, 14:00

Add padding to the top & bottom of a row height

Post by gailb »

Is it possible to add padding to the top & bottom of a row height?

I have ~ 31,100 rows and when I auto fit them, they fit to the size of the row height. This works okay, but for reading purposes, it looks scrunched.

Is it possible to add padding to these rows? So lets say the row autofits to 40.5. Can we add maybe 10% to the height making it something like 44.55.

User avatar
HansV
Administrator
Posts: 78592
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Add padding to the top & bottom of a row height

Post by HansV »

You could run this macro:

Code: Select all

Sub FitAndPad()
    Dim r As Range
    Selection.EntireRow.VerticalAlignment = xlVAlignCenter
    Selection.EntireRow.AutoFit
    For Each r In Selection.Rows
        r.RowHeight = r.RowHeight * 1.1
    Next r
End Sub
Select the range before running it.
If you store the macro in your personal macro workbook Personal.xlsb, it will be available in all workbooks.
Best wishes,
Hans

gailb
3StarLounger
Posts: 254
Joined: 09 May 2020, 14:00

Re: Add padding to the top & bottom of a row height

Post by gailb »

Thanks Hans. This will work great.