Skip to content

Undo Format

The recovery path for the whole Format group. Before each Smart Formatting pass the add-in captures a snapshot of the cells it’s about to change; clicking Undo Format restores the most recent one and refreshes. It’s a multi-level, in-session stack — click again to walk back earlier passes — and it is deliberately separate from Excel’s Ctrl+Z, because the add-in’s writes don’t feed Excel’s native undo.

Why it exists

ModelXcel Pro applies styles and values through Excel’s object model. Those programmatic writes do not populate Excel’s native undo stack — so pressing Ctrl+Z will not reliably reverse a Smart Format pass, and may not bring back the previous state at all. Undo Format is the supported way back: a self-contained recovery for the Format group.

Where to find it

ModelXcel Pro tab → Format group → Undo Format (keytip UF). It’s enabled only when there’s a pass available to undo — otherwise it’s greyed out (and it’s greyed out entirely when the license is inactive).

How it works

Before each pass — Format Selection / Sheet, a live Auto Format pass, Text Case, or an Empty Refs apply — the add-in pushes a snapshot onto a stack. Undo Format pops the most recent one and restores it:

  • Multi-level. The stack holds up to 20 passes (the Undo Levels setting). One click reverses one pass; click again to walk back earlier passes while snapshots remain.
  • Deep per-cell capture. Each snapshot records, for the affected cells: the value and formula, the style name, the number format, the full font (color, bold, name, size, italic, underline), the interior (pattern and colors), all four borders, and the conditional-formatting rules on the range.

What it can restore

  • Cell styles — but only on cells that still carry one of the add-in’s own (“Mx”) styles. If you manually restyled a cell to something else after formatting it, Undo Format intentionally leaves it as you set it.
  • Number formats, fonts, fills, borders, and the conditional-format rules in the range.
  • Cell values and formulas — which is what reverses a Text Case change, since that edits the cell’s text.
  • Empty-reference highlights — only when they were snapshotted. The standalone Empty Refs buttons snapshot first (a workbook-wide pass captures only the active sheet); but when Empty Refs runs as a Format-pass rider the highlights are applied after the style snapshot and aren’t in it — a pass with only empty-ref highlights and no numeric/flag styling isn’t snapshotted at all, so Undo Format may not remove them.

What it cannot undo

Two things are outside the snapshot

Undo Format does not reverse column widths from Auto Fit (widths are never snapshotted), and it does not reverse theme changes (a theme rewrites named styles directly, with no snapshot). Restore a width manually — Auto Fit runs through COM automation and registers no native undo step, so don’t rely on Ctrl+Z; revert a theme by applying a different theme or Default.

Undo Format vs. Excel’s Ctrl+Z

Undo Format (UF)Excel Ctrl+Z
Reverses Smart Formatting?Yes — the supported pathNo — not reliable for COM-applied styles
DepthUp to 20 passes this sessionExcel’s own stack (often cleared by the add-in’s writes)
Reverses ordinary edits?No — only formatting passesYes — use it for normal typing
Survives closing Excel?NoNo

The add-in deliberately does not hook into Excel’s native undo — Undo Format is the intended button. Use Excel’s Ctrl+Z for ordinary edits, and Undo Format for any Format-group operation.

Step by step

  1. Run a Format command and decide you want it back.
  2. Click Undo Format (UF). The cells from the most recent pass are restored to their captured prior state, and the button refreshes — staying enabled if earlier passes can still be undone.
  3. Click again to undo the next-most-recent pass; repeat to walk further back while snapshots remain.

Limits & recovery

  • Only the last operation? No — up to 20. But the depth is the Undo Levels setting (default 20), and once a pass falls off the end of the stack it can no longer be undone.
  • Session-only. The history lives in memory and is cleared when you close Excel or reload the add-in — you cannot undo formatting from a previous session. There is no persisted recovery.
  • Very large passes aren’t snapshotted. A pass over roughly 100,000 cells is not captured, so it cannot be undone even though the formatting was applied. Save before formatting a very large sheet.
  • Manually restyled cells are left alone by design (see above).
  • If a pass is gone from history, recover by re-styling the cells (for example back to Normal) or by re-running the formatting you want.

Why COM writes clear Excel’s native undo

When an add-in writes to cells through Excel’s object model (rather than as a user edit), Excel generally clears its own undo stack — so even ordinary edits you made before a format pass may no longer be reversible with Ctrl+Z afterward. This is standard Excel behavior for programmatic changes, and it’s exactly why Undo Format keeps its own snapshot history.

Why the button is greyed out

  • Nothing to undo — no pass has run this session, or you’ve already undone everything. The history also resets each time you reopen Excel.
  • License inactive — the whole Format group is disabled when the license is expired or invalid.

Related