Widening a Column to a Particular Cell's Width

by Allen Wyatt
(last updated September 18, 2021)


When Robert double-clicks the right edge of a column header, Excel widens the column to fit the widest content of any cell in that column. Sometimes, though, that is just too wide. So, Robert wonders if there is a similar feature to double-click a cell edge and have the column widen to fit the contents of just that cell, even if there is a cell in the column with wider content.

There is no built-in double-click option to do this, but there is a way. Here's the simple steps:

  1. Select the cell that contains the text.
  2. Display the Home tab of the ribbon.
  3. In the Cells group, click the Format tool. Excel displays a drop-down list of options.
  4. Choose the AutoFit Column Width option.

The result is that the column width is set so that whatever is in the selected cell is entirely visible. If you prefer a keyboard-based approach, you can press the Alt key to trigger the hot keys for the ribbon tools, and then press H, O, I. If you prefer, you can use a legacy shortcut key sequence—again, press Alt to trigger the hot keys, and then press O, C, A. Either approach will work just fine.

If you prefer a macro-based approach, then you can use the following single-line macro:

Sub ColWidthCell()
End Sub

The macro can, of course, be assigned to a shortcut key or to a customization of the ribbon so that it can be easily triggered.


If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11302) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365.

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. ...


Selecting a Cell in the Current Row

Macros often need to select different cells in a worksheet. Here's how you can use macro commands to change which cell is ...

Discover More

Changing Sections

When you divide your document into sections in order to change page layout attributes, you need to give some thought to ...

Discover More

Listing Combinations

You can easily use the COMBIN worksheet function to determine the number of combinations that can be made from a given ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Countering Compressed Columns

If you open a workbook and find that the width of some of your columns has been changed, the discovery can be ...

Discover More

Unhiding a Limited Number of Columns

If you have a bunch of hidden columns in your worksheet, you might want to unhide only a portion of those columns. This ...

Discover More

Hiding Columns Based on a Cell Value

Need to hide a given column based on the value in a particular cell? The easiest way to accomplish the task is to use a ...

Discover More

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

View most recent newsletter.


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 9 - 3?

2021-09-18 15:27:52

J. Woolley

This Tip's macro works well when ActiveCell is not a merged cell. The following VBA is more general:

Sub SetColumnWidthByCell()
    Dim rMA As Range, rCol As Range
    Dim nC As Long, nW As Double
    Set rMA = ActiveCell.MergeArea
    nC = rMA.Columns.Count
    If nC = 1 Then
        nW = ActiveCell.ColumnWidth / nC
        For Each rCol In rMA.Columns
            rCol.ColumnWidth = nW
        Next rCol
    End If
End Sub

See My Excel Toolbox: https://sites.google.com/view/MyExcelToolbox/

2021-09-18 11:20:51

Aldo Santolla

Another macro approach could be:

Sub SetColWith()
'Shortcut key set : Ctrl+Shft+W
ActiveCell.Columns.ColumnWidth = InputBox("New column width:", "Adjust Column Width")
End Sub

2021-09-18 09:20:06


You can also add "AutoFit Column Width" to Quick Access Toolbar. Once you find it on the Home Ribbon, just right click on it and select "Add to Quick access Toolbar"

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

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.