Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Setting Cell Width and Height Using the Keyboard.

Setting Cell Width and Height Using the Keyboard

Written by Allen Wyatt (last updated October 29, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


13

Sawan wonders if there is a way to adjust the height and width of a cell by using the keyboard, without using the mouse. (Some people are really averse to using the mouse.) The answer is yes, there is a way. The problem, however, is that it isn't a terribly intuitive way.

Here's how you set the row height:

  1. Press Alt. This kicks Excel into a "shortcut key mode" and you should see the shortcut keys appear above each tab of the ribbon.
  2. Press H to indicate you want to use the Home tab. New shortcut keys appear above each tool in the tab.
  3. Press O to indicate you want to use the Format tool in the Cells group. Excel displays a drop-down list of options.
  4. Press H to choose the Row Height option. Excel displays the Row Height dialog box.
  5. Type the value you want for the row height.
  6. Press Enter.

The only difference in these steps when you want to specify the column width is that you should press W in step 4.

Here's a different method of changing the row height:

  1. Press Shift+Spacebar. Excel selects the entire row.
  2. Press Shift+F10 to display a Context menu. (This is the same menu you see if you were to right-click on the selection.)
  3. Press R to indicate you want to change the row height. Excel displays the Row Height dialog box.
  4. Type the value you want for the row height.
  5. Press Enter.

A similar sequence will work for setting the column width:

  1. Press Ctrl+Spacebar. Excel selects the entire column.
  2. Press Shift+F10 to display a Context menu. (This is the same menu you see if you were to right-click on the selection.)
  3. Press C twice to choose the second "C" command in the Context menu (Column Width).
  4. Press Enter. Excel displays the Column Width dialog box.
  5. Type the value you want for the column width.
  6. Press Enter.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (6242) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Setting Cell Width and Height Using the Keyboard.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Transferring Fonts

Do you want to transfer fonts from one computer system to another? It is relatively easy to do, but there is one ...

Discover More

Skipping Numbering

Got a numbered list, but you want to add other types of non-numbered paragraphs in the middle of the list? It's easy to ...

Discover More

Controlling Case in Find and Replace

When using Find and Replace, how Word handles the case of letters in replacements can be confusing. It needn't be, if you ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Changing Currency Formatting for a Single Workbook

Currency is formatted differently in different corners of the world. Most formatting uses periods and commas to indicate ...

Discover More

Understanding Underlines

Excel provides a variety of underlining styles you can use when you need to underline information within a cell. Here's ...

Discover More

Understanding Monospace Fonts

Information in a worksheet needs to be displayed using fonts. If you understand the two different types of fonts ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is four more than 4?

2022-11-28 12:13:22

J. Woolley

@Larry Schwartz
In your comment dated 2022-11-02 you said, "If I click on the bottom border of the row number, Excel now shows both inches and pixels." I wondered why you referred to inches because in Normal view Excel shows the height in points and pixels. Now I realize you were in Page Layout view instead of Normal view. In Page Layout view the Row Height and Column Width dialogs display and accept inches; in Normal view it is points.
It was my understanding that Excel normally assumes 96 pixels/inch, but your comment described "144 pixels to the inch." I'm curious what computer you are using. If you run the DisplayScreenMetrics macro described in my comment dated 2022-11-03, does it report 144 Windows Dots/inch? Does your screen display 144 Pixels/inch?


2022-11-07 09:13:57

J. Woolley

@Larry Schwartz
After reading the Description section at https://sites.google.com/view/MyExcelToolbox, please leave a comment at https://sites.google.com/view/MyExcelToolbox/Comment explaining your difficulty and I will try to help.


2022-11-06 16:04:13

Larry Schwartz

Contributor Wolley's Excel Tool Box has lots of stuff. HGowever, from the web site, I can't figure out how to access his work. Opening Google Sheets gives me nothing. A newbee's guide would be helpful.


2022-11-06 15:06:31

J. Woolley

My Excel Toolbox includes the SetColumnWidthPixels and SetRowHeightPixels macros, which are improved versions of the macros described in my last comment.
See https://sites.google.com/view/MyExcelToolbox/


2022-11-06 05:01:40

Barry

Wow! That is fantastic - thank you. Once again the kindness of strangers shines bright.
Barry


2022-11-05 17:45:27

J. Woolley

@Barry
If you must, these macros will set column width and row height in Excel pixels (rounded to the nearest integer):

Sub ColWidthPixels()
Dim R As Range, X As Double
Dim W As Integer, msg As String
Const myName = "ColWidthPixels", PxPerPt = 96 / 72
Set R = Selection.Columns(1)
W = R.Width * PxPerPt
msg = "Enter column width in pixels:"
W = Application.InputBox(msg, myName, W, Type:=1)
If W <= 0 Then Exit Sub
X = R.ColumnWidth / R.Width
Selection.ColumnWidth = X * W / PxPerPt
'repeat (this is necessary)
X = R.ColumnWidth / R.Width
Selection.ColumnWidth = X * W / PxPerPt
'repeat again (for good measure)
X = R.ColumnWidth / R.Width
Selection.ColumnWidth = X * W / PxPerPt
End Sub

Sub RowHeightPixels()
Dim H As Integer, msg As String
Const myName = "RowHeightPixels", PxPerPt = 96 / 72
H = Selection.Rows(1).RowHeight * PxPerPt
msg = "Enter row height in pixels:"
H = Application.InputBox(msg, myName, H, Type:=1)
If H <= 0 Then Exit Sub
Selection.RowHeight = H / PxPerPt
End Sub

These macros will work with any selection on the active worksheet, but merged cells might be a problem.


2022-11-04 15:34:19

J. Woolley

@Barry
1. In my last comment, "Windows makes column width confusing." should have been "Excel makes column width confusing." In fact, the entire comment would be better if each instance of the word Windows were replaced with Excel.
2. I believe I explained how to set by pixel; see "... to add 1 Windows pixel." (Replace Windows with Excel.)
3. Many systems will have 96 screen pixels/inch; in this case, an Excel pixel is the same as a screen pixel. If you review Figure 1 from my last comment, my system has 88.2 screen pixels/inch, so I must Zoom by 88.2/96 = 92% to make Excel's pixel match my screen's pixel. Use the DisplayScreenMetrics macro to compare with your system.
See https://sites.google.com/view/MyExcelToolbox/


2022-11-04 06:13:11

Barry

Am I right to assume from J. Woolley's comment that there is no way to set column width and row height by pixel because; if I have understood correctly; pixels are different things in different 'systems'?


2022-11-03 13:44:38

J. Woolley

@Larry Schwartz
The Row Height dialog displays and accepts a value in points. There are 72 points/inch. Windows assumes 96 dots/inch and refers to each dot as a pixel, so there are 96/72 = 4/3 Windows pixels/point. A Windows pixel is not necessarily the same as your display screen's pixel.
If you make the row height 15 points, it will be 20 Windows pixels. Add 0.75 point to add 1 Windows pixel. Add 1.5 points to add 2 Windows pixels.
Windows makes column width confusing. The Column Width dialog displays and accepts the number of Normal style zero (0) characters that will fit in the cell. Suppose you enter 15 in the Column Width dialog. Now if you left-click that column's border in the header it will indicate something like
    Width: 15.00 (110 pixels)
(This example assumes Normal style uses 11 point Calibri Regular font.) For this case, the width of a Normal style zero (0) character is 110/15 = 7.33 Windows pixels or 5.5 points. Add 0.14 character to add 1 Windows pixel. Add 0.27 character to add 2 Windows pixels.
On my system, one 11 point Calibri Regular font zero (0) character is 5.5 points wide and 11 points high. When entered in a cell with AutoFit, the cell is 14 Windows pixels (10.5 points) wide and 20 Windows pixels (15 points) high.
My Excel Toolbox includes the DisplayScreenMetrics macro (see Figure 1 below) . It computes the Zoom factor necessary for displaying Excel's Page Layout in actual size.
See https://sites.google.com/view/MyExcelToolbox/
See https://excelribbon.tips.net/T008768_Changing_Width_and_Height_to_Inches.html
See https://learn.microsoft.com/en-us/office/troubleshoot/excel/determine-column-widths

Figure 1. 


2022-11-02 15:46:04

J. Woolley

Here's another way to avoid the mouse, but it involves adding some macros:

Sub ColWidthDialog()
Application.Dialogs(xlDialogColumnWidth).Show
End Sub

Sub RowHeightDialog()
Application.Dialogs(xlDialogRowHeight).Show
End Sub

Sub MyMacros()
Dim Macros(), n, msg, last
Macros = Array("ColWidthDialog", "RowHeightDialog")
For n = 0 To UBound(Macros)
    msg = msg & (n + 1) & ": " & Macros(n) & vbNewLine
    last = last + 1
Next n
msg = msg & vbNewLine & "Enter a number to run that macro:"
n = Application.InputBox(msg, "MyMacros", 1, Type:=1)
If n > 0 And n <= last Then Run Macros(n - 1)
End Sub

Use Developer > Macros to open the Macro dialog, then pick MyMacros (see Figure 1 below) . Click the Options... button to open the Macro Options dialog, then type lower-case r to make the shortcut key Ctrl+r (see Figure 2 below) . Now you can press Ctrl+r to start MyMacros, then type a number to open the Column Width dialog or the Row Height dialog (see Figure 3 below) .
Notice it is easy to add additional macros to the Macros list in MyMacros.
Finally, My Excel Toolbox includes the AdjustColumnWidths macro to adjust the width of selected columns by a fixed increment or a proportional multiplier. The AdjustRowHeights macro will adjust the height of selected rows in the same way. Both macros support Undo (Ctrl+Z).
See https://sites.google.com/view/MyExcelToolbox/

Figure 1. 

Figure 2. 

Figure 3. 


2022-11-02 15:01:27

Larry Schwartz

Referring to my note about setting cell height and width by keyboard using pixels, I'm now using Office 2021. If I click on the bottom border of the row number, Excel now shows both inches and pixels. So, I could make my change in inches, however, I often want to make a 1 or 2 pixel height change so inches is too gross a measurement.
Using Shift+F10, I tried a number followed by " p" and by " pixels", but neither is accepted. In Excel, a 73 pixel row is shown as .51". From the net, I tried UnitConverters.Net which converted 73 pixels to .7604". Next I tried Pixelto.net and pixelsconverter.com show the same result, .7604". These seem to be based on a 96 pixel inch. The Excel ratio is 144 pixels to the inch. Somewhere in mypast I think that it was 72 pixels to the inch.
While adjusting row height with the cursor is difficult, Alan's way of using Shift+F10 allows precision control without messing with the mouse. So, my problem is solved.


2022-10-31 13:21:15

Larry Schwartz

Still okking for an answer about setting cell height and width by keyboard using pixels. I notice that someone named Barry asked the same question.


2022-10-29 12:16:32

Barry

Hi
On the subject of cell height and width settings...
Is there a way to set the default so that you can type in the cell size in number of pixels (as displayed when you double-click on the division line between two rows/columns).


Regards
Barry


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.