Changing Default Row Height
Loretta wants to set a default row height with word wrap, but she also wants automatic row height to play into it. She doesn't want some "skinny" rows to appear. The default row height in her worksheet seems to be 12.75 but she'd like that to be, perhaps, 25 and then auto-adjust for any rows that need to have more height. She wonders how to make the default work this way.
There are two ways you can specify row height in a worksheet: explicitly or implicitly. You specify an explicit row height by using the tools on the ribbon to specify the exact height you want used for a particular row or rows. When you do so, you are "locking" the row height so that it is always what you specified.
Implicit height is calculated by Excel based on the size of the largest font used in the row. The default font for Excel is 10-point Calibri, so the row height is calculated to be 12.75. There seems to be no rhyme or reason on how this calculation occurs. For instance, if you change from 10-point Calibri to 20-point Calibri, you would expect the row height to double—but it doesn't. Instead, the row height becomes 26.25. If you change the font from Calibri to Arial, but leave it at 20 points, the row height automatically changes to 25.5.
Loretta wants the row height to be 25 and adjust larger, if necessary, and she wants it to be done automatically. There are no settings to do this. If you change the row height for a workbook to 25, explicitly, it won't adjust larger automatically. That means you need to leave the row height set to implicitly adjust (done by choosing AutoFit as the row height) and, somehow, get it to go no lower than 25.
The only way we've been able to determine to do this as Loretta envisions is to change the font and/or font size for the worksheet. As already noted, you could specify a default 20-point Arial font, and your row height would be 25.5—pretty close to Loretta's desire. This is a rather large font, but you could change the size of the font in individual columns (or cells) within a row and not have it affect the row height. This is true as long as at least one cell in the row is formatted to use a 20-point Arial font.
To change the default font used by Excel, follow these steps:
- Display the Excel Options dialog box. (In Excel 2007 click the Office button and then click Excel Options. In Excel 2010 and Excel 2013 display the File tab of the ribbon and then click Options.)
- General should be clicked, by default, at the left of the dialog box—unless you are using Excel 2007, in which case Popular should be clicked. (If it isn't for some reason, click it.) (See Figure 1.)
Figure 1. The General options of the Excel Options dialog box.
- Use the Use This as the Default Font drop-down list to choose which font you want used.
- Use the Font Size drop-down list to choose the size of that font you want used.
- Click OK.
Another approach is to adjust a column's font after you create a new workbook. For instance, let's say you open a new workbook, and you know that the data you enter will occupy rows in columns A through M. You could select column N (one column past where you will be working) and change the font for that single column to 20-point Arial. Excel automatically adjusts the row height in all the rows to 20.5 based on the new implicit row-height calculation for column N. There doesn't have to be any data in column N; you just need to adjust the font and/or font size for the column.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (5663) applies to Microsoft Excel 2007, 2010, and 2013.
Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!
Leave your own comment:
Comments for this tip:
Stan Straatman 10 Jun 2016, 10:49
No way to have a defaul Row height in Excel. Solved it to one colomn with bigger font. Excel is than adjusting according that font. Make that colomnn hidden.
Change than back to Autofit Row Height.
With this you have a changed standard row hight and can make use of autofit.
Madhur 19 Apr 2016, 21:48
Hey Bill, thanks for this superb trick!! So simple yet so effective!! Thanks once again!
Bill M 13 Apr 2016, 09:40
My spreadsheet columns are from A to K, and the font is 9 for everything. In Column L (which is outside my work area and contains no text), I selected the entire column and changed the font to 12. This allowed all of the rows in my work area to expand height-wise.
Morris Manning 04 Mar 2016, 14:30
If working with merged cells, this works for me. Place in appropriate sheet, set intersect ranges and set NewRhHt to desired factor.
Private Sub Worksheet_Change(ByVal Target As Range)
''Excel does not have a feature which autofits row heights on merged cells.
''This macro does perform an autofit of row heights on designated merged cells.
''Adapted from Jim Reck by Greg Wilson, with modifications suggested in a blog _
by Debra Dalgleish with comments by "Smallman", (Ozfrid MVP) and others.
Dim NewRwHt As Single
Dim cWdth As Single, MrgeWdth As Single
Dim c As Range, cc As Range
Dim ma As Range
'Substitute one or more cell address below representing merged ranges where row height will be automatically _
adjusted to account for wrapped text. Reducing text to one line will automatically reduce row height accordingly. _
Since this code changes only one merged range at a time, it is much faster than using an array approach which _
causes processing all target ranges for each change in one cell.
'Cell addresses representing merged ranges must be unlocked in a protected sheet or workbook.
If Not Intersect(Target, Range("B23, B25, B27, B29, B31, B32, B33, B34, B35, B36, B37, B38, B39, B40, B41, B42")) Is Nothing Then
If .MergeCells And .WrapText Then
Set c = Target.Cells(1, 1)
If c.Locked = True Then
c.Locked = False
cWdth = c.ColumnWidth
Set ma = c.MergeArea
For Each cc In ma.Cells
MrgeWdth = MrgeWdth + cc.ColumnWidth
Application.ScreenUpdating = False
ma.MergeCells = False
c.ColumnWidth = MrgeWdth
NewRwHt = c.RowHeight
c.ColumnWidth = cWdth
ma.MergeCells = True
ma.RowHeight = NewRwHt * 1.3 'This increases row height by a factor of 30%. Adjust as desired
cWdth = 0: MrgeWdth = 0
If c.Locked = True Then
c.Locked = False
Application.ScreenUpdating = True
Jan 04 Mar 2016, 07:39
I did the changes as suggested here. However, my "Options" box did not have all of the options your screen shot had. Is it due to the version or are you using an "advanced" option?
Philip 23 Dec 2015, 10:03
One way to achieve this is to insert a column and in each cell down add any character; format the font for this column as say 22. This turns up the row height to 30 or so and still allows a auto row height. Then hide the column. QED
Alice 24 Jul 2013, 10:47
C Jenkins quick workaround fixed it for me! Thank you! This has been bugging me for awhile. Brilliant fix!
LCable 16 Jul 2013, 12:01
That worked! Thanks!
Willy Vanhaelen 16 Jul 2013, 11:55
Do the following to be sure you copy the macro in the right place:
- Activate the sheet you want the macro to work in.
- Click the 'Developer' tab in the ribbon.
- Click 'View Code' in 'Controls'.
- That's the place were you can copy the macro.
- Be sure NOT to change the macro's name.
The macro will only be triggered when the cell's content is changed. Simply changing the font size for example will not trigger it unless you afterwards press F2 and Enter.
LCable 15 Jul 2013, 14:28
I tried Willy's macro and couldn't get it to work properly when I thought it would adjust the line height to higher than 25. I put his macro into a new macro saved in the worksheet I was using. Wasn't sure about his direction to put it in the VBA project.
Aldo 09 Jul 2013, 17:03
Don ... if your organization creates Certificates for each person required, then you can use those to maintain security and still be able to create and use custom macros.
Have your IT people look into it. The certificate writer is included in MS Office.
Don 08 Jul 2013, 14:11
Willy...Thanks for the macro. I've got a slightly different use for it, resetting row height when there are merged cells.
There is one problem with macros (and I use a lot of them): Sometimes organizations place security restrictions on and lock that on people's PCs.
C Jenkins 08 Jul 2013, 01:30
Another solution is select one column, change the font to give you the desired row height.
Now hide the column from view.
Setup the selected columns with text wrap, ensure the text in these columns is set vertically in the centre.
Willy Vanhaelen 06 Jul 2013, 11:06
Here is a solution to do this autmatically.
Set the row height explicitly to 25 for the entire worksheet or the range you want as explained in the second paragraph above.
Place this little macro in the corresponding sheet in the VBA project (not in a module!). When entering data it will adjust the row height automatically to larger when necessary or keep it / restore it to 25 otherwise:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Rows.RowHeight < 25 Then Target.Rows.RowHeight = 25