Auto Fit
Resize columns so they’re just wide enough to show their contents — Excel’s own column auto-fit, reached from the Format group and wired into the Smart Formatting workflow. It is deliberately width-only: it never touches styles, number formats, fonts, or values. Use the button for a one-shot fit, the dropdown for the whole sheet, and the checkbox to keep columns sized automatically as you build.
The scenario
After a format pass, or any time wider number formats and longer labels have left columns showing #### or clipped text, you just want the columns to breathe. Auto Fit sizes them to their contents — one selection, the whole sheet, or continuously as you type.
Where to find it
ModelXcel Pro tab → Format group → the Auto Fit split button (keytip AT). The button face does one thing; the dropdown holds the rest:
- Auto Fit (the face) — fit the columns touching your current selection.
- Fit Selection (dropdown) — the same as the face.
- Fit Sheet (dropdown) — fit every column in the active sheet’s used range.
- Auto-Fit while typing (dropdown checkbox) — keep columns sized automatically as you edit and run Format commands.
The primary button: Fit Selection
Clicking the button face fits the columns intersecting your selection. It needs a selection — with nothing selected it shows “Please select a range first.”
The face and “Fit Selection” are identical
Both the button face and the Fit Selection dropdown item route to the same action and always fit the current selection. There is no separate “default” behavior — they do exactly the same thing.
Fit Sheet
Fit Sheet resizes every column across the active sheet’s effective used range — the add-in finds the last truly populated row and column rather than trusting Excel’s tracked used range, which can carry a phantom overhang. If the sheet is empty it reports “No used cells found…”.
What it writes — and the whole-column caveat
Only column widths. Every Auto Fit path calls Excel’s column auto-fit on the entire columns that intersect the target, then recalculates. It does not change row heights, cell styles, fonts, number formats, values, or formulas — it is purely a width adjustment.
Auto-fit sizes whole columns, not just your rows
Because it acts on entire columns, a column is sized to its widest visible cell anywhere in that column, not only the rows you selected. “Fit Selection” on A1:B5 widens columns A and B across all their content, not just rows 1–5. A single long label far down a column will widen it.
One-shot fit vs. “while typing”
There are two distinct modes, and they behave differently:
| One-shot (button / Fit Sheet) | Auto-Fit while typing | |
|---|---|---|
| Trigger | You click it | Runs automatically after edits (debounced) and after Smart Formatting commands |
| Depends on the checkbox? | No — runs regardless of the “while typing” setting | Yes — only while the checkbox is on |
| Scope | Selection, or the sheet’s used range | Just the columns of the cells you edited or that were just formatted |
“While typing” shares the same edit watcher as Auto Format: it resizes affected columns a moment after you stop typing, and it also runs at the end of a Format Selection / Sheet pass when the option is on.
Persistence across restarts
“Auto-Fit while typing” is remembered
Unlike Auto Format (which always starts off), the Auto-Fit while typing checkbox persists across Excel restarts. Its state is written to your per-user settings file (%APPDATA%\ModelxcelPro\smart-formatting-settings.json) and reloaded when the add-in starts — so it stays on (or off) between sessions and mirrors the Enable Auto-Fit Columns option in Settings. The default is off.
Step by step
- Fit a block: select the cells (or whole columns) and click Auto Fit.
- Fit a whole tab: open the dropdown and choose Fit Sheet.
- Keep it sized as you work: open the dropdown and tick Auto-Fit while typing. It stays on across restarts.
- Go back to manual: untick it — this stops future resizing but leaves current widths as they are.
Practical examples
- Model review. A column shows
####after you switched on a wider number format — one click on the cell, Auto Fit, and the value is readable again. - Cleaning an imported sheet. A data dump arrives with cramped columns — Fit Sheet sizes the whole tab in one go.
- Preparing an output. Before sharing or printing a summary, Fit Sheet ensures nothing is clipped; leave “while typing” on during the build so columns keep pace as you add rows.
Undo & recovery
- Auto Fit is not covered by Undo Format. Column-width changes are not snapshotted, so the add-in’s Undo Format button will not restore a prior width — it only restores styles, number formats, fonts, fills, borders, values, and conditional formats from a formatting pass.
- To recover a width, set it back manually (right-click the column header → Column Width, or drag the boundary). Don’t rely on Ctrl+Z: Auto Fit runs through Excel’s COM automation and registers no native undo step, so Excel’s own undo will not reliably reverse it.
- Turning off “while typing” stops further resizing but does not restore previous widths.
Related
- Format Selection & Sheet — can run Auto Fit as the last step of a format pass.
- Auto Format — shares the same edit watcher; don’t confuse its session-only behavior with Auto-Fit’s persistence.
- Formatting Settings — the Enable Auto-Fit Columns option mirrors the checkbox here.