Excel: Expand All Columns to Fit Text With AutoFit (Every Method)
How to expand all columns in Excel to fit text using AutoFit: select-all and double-click, the ribbon, the Alt H O I shortcut, Mac steps, VBA, and fixes when it fails.
To expand all columns in Excel to fit their text, click the Select All button (the triangle where the row numbers meet the column letters, or press Ctrl+A), then double-click any boundary between two column headings. Every column with content resizes to fit its widest entry; you can also use Home > Format > AutoFit Column Width or the keyboard sequence Alt, H, O, I.
That covers most cases. Below are the details for each method, how it works on a Mac, how to automate it, and what to check when AutoFit doesn’t seem to do anything. Steps are based on Microsoft’s documentation as of October 2026; ribbon labels can shift slightly between Excel versions.
The fastest way: select all and double-click
Microsoft’s own guide to changing column width describes this as the quick way to AutoFit every column on a worksheet.
- Click the Select All button in the top-left corner of the grid, or press Ctrl+A (you may need to press it twice if your cursor is inside a block of data).
- Hover over the line between any two column letters, for example between A and B, until the pointer turns into a double-headed arrow.
- Double-click.
Each column now fits its longest value. Empty columns are left alone.
If you only want certain columns resized, select those column headers first (drag across them, or Ctrl+click for non-adjacent ones) and double-click a boundary inside the selection.
Using the ribbon
If double-clicking feels fiddly, the ribbon command does the same job:
- Select the columns, or the whole sheet with Select All.
- Go to the Home tab.
- In the Cells group, click Format.
- Under Cell Size, choose AutoFit Column Width.
The same Format menu also has AutoFit Row Height, which is useful when you have wrapped text and rows look clipped.
The keyboard shortcut: Alt, H, O, I
On Windows, you can trigger the ribbon command without the mouse. Select your columns (or press Ctrl+A), then press these keys one after another, not together:
- Alt to activate ribbon shortcuts
- H for the Home tab
- O for Format
- I for AutoFit Column Width
This is a ribbon key tip sequence, so it follows the menu path described above. Multiple tutorial sites document it, including Automate Excel.
Watch what you select first
Automate Excel points out an easy mistake: if you click a single cell and run AutoFit Column Width, Excel sizes the column to the text in that cell, not to the longest entry in the column. To fit the whole column, select the entire column (click its letter) or the whole sheet before running the command.
Expanding columns in Excel for Mac
On a Mac, Microsoft’s Excel for Mac guide documents the double-click method:
- Select the columns you want to fit, or click the Select All corner to select the whole sheet.
- Point to the separator on the right side of any selected column heading.
- Double-click.
You can also use the menu bar: Format > Column > AutoFit Selection (the exact wording may differ slightly by version).
Sources disagree on a built-in Mac keyboard shortcut for AutoFit, and Microsoft’s Mac page doesn’t list one, so we wouldn’t rely on any combination you see quoted online. If you want a shortcut, macOS lets you assign your own: go to System Settings > Keyboard > Keyboard Shortcuts > App Shortcuts, add Microsoft Excel, and type the menu command name exactly as it appears in Excel’s menu.
Comparing the methods
| Method | Best for | Platform |
|---|---|---|
| Select All + double-click a boundary | Quickest way to fit every column | Windows and Mac |
| Home > Format > AutoFit Column Width | When you prefer menus or a precise selection | Windows (Mac has Format menu equivalent) |
| Alt, H, O, I | Keyboard-only workflow | Windows |
VBA Columns.AutoFit | Repeating the fit on every refresh or across many sheets | Desktop Excel with macros |
Automating it with VBA
If you rebuild a report every day and always AutoFit afterwards, a macro can do it for you. Microsoft’s Range.AutoFit reference shows the syntax. To fit every used column on the active sheet:
Sub FitAllColumns()
ActiveSheet.UsedRange.Columns.AutoFit
End Sub
To fit specific columns, Microsoft’s example is:
Worksheets("Sheet1").Columns("A:I").AutoFit
Two details from the documentation worth knowing:
- AutoFit must act on whole rows or whole columns, otherwise you get an error. Using
.Columns.AutoFiton a range handles this. Range("A1:E1").Columns.AutoFitsizes columns A to E based only on the contents of A1:E1, not the full columns. That’s handy when you want columns to fit a header row and ignore long values further down, but it can surprise you if you expected the full column to be measured.
Macros require a macro-enabled workbook (.xlsm) and desktop Excel, so check your organization’s macro policy before rolling this out to a team.
When AutoFit doesn’t work
Merged cells
This is the most common culprit. Microsoft’s support article KB 212010 states that you can’t use AutoFit on a column that contains a cell merged with cells in other columns (and the same applies to rows with cells merged across rows). Microsoft describes this as by design, not a bug.
Your options:
- Unmerge the cells (Home > Merge & Center > Unmerge Cells) and run AutoFit again.
- Set the width manually via Home > Format > Column Width if the merge must stay.
Wrapped text
When Wrap Text is on, text breaks onto new lines inside the cell instead of spilling past it, so AutoFit Column Width has less to work with and the column may not widen as you expect. If you want long text on one line, turn off Wrap Text for those cells first, then AutoFit the columns. If you want wrapping, keep the column at a sensible fixed width and use AutoFit Row Height instead.
If row height doesn’t adjust after wrapping, Microsoft’s guidance for this situation is that it can happen when a row’s height was changed manually; run AutoFit Row Height on that row again.
Hashes (###) still showing
Microsoft notes that ### appears when a column is too narrow for its data. If you still see it after AutoFit, check whether the cell is part of a merged range (see above), or whether the column was excluded from your selection.
Very long text
AutoFit sizes a column to the longest entry, so a single cell with a long sentence or URL can make one column enormous. In that case it’s often better to set a fixed width for that column and turn on Wrap Text, then AutoFit the rest.
A practical routine
For most sheets, this order gives clean results:
- Turn off Wrap Text on cells where you want single-line values.
- Unmerge any cells you don’t truly need merged.
- Press Ctrl+A and double-click a column boundary (or Alt, H, O, I on Windows).
- Set fixed widths for any columns that grew too wide, enable Wrap Text there, then AutoFit Row Height.
Remember that AutoFit is a one-time adjustment, not a live setting. When new, longer data arrives, run it again, or use the VBA approach if you do this often.
Free apps worth trying
SponsoredSponsored links. Installing through them can earn us a commission, at no cost to you. Apps are free to download; some offer optional in-app purchases.
Frequently asked questions
Why does Excel show #### instead of my numbers? +
Microsoft notes that ### appears when a column is too narrow to display its data. AutoFit the column (double-click the right edge of its header) and the value will show in full.
Why won't AutoFit change a column that has merged cells? +
According to Microsoft, AutoFit doesn't work on a column that contains a cell merged across other columns, and Microsoft treats this as by design. Unmerge the cells and AutoFit again, or set the width manually.
Is there a keyboard shortcut to AutoFit columns on a Mac? +
Microsoft's Mac support page documents the double-click method and the Format menu, not a dedicated shortcut. Some third-party sites list a key combination, but we couldn't confirm it, so the safest option is to create your own via macOS App Shortcuts for the AutoFit Selection menu command.
Does AutoFit keep adjusting as I type new text? +
No. AutoFit sizes columns to the content that's there when you run it. If you add longer entries later, run it again on the affected columns.
Sources
- Change the column width or row height in Excel (Microsoft Support) (support.microsoft.com)
- Change column width or row height in Excel for Mac (Microsoft Support) (support.microsoft.com)
- Range.AutoFit method (Excel) (Microsoft Learn) (learn.microsoft.com)
- You cannot use AutoFit for rows or columns that contain merged cells in Excel (Microsoft KB 212010) (support.microsoft.com)
- How to AutoFit Columns in Excel & Google Sheets (Automate Excel) (automateexcel.com)