VBA triggers Runtime Error 1004: “That command cannot be used on multiple selections.” when a macro executes a command, such as .Copy, .Cut, .Sort, or .Delete, on a range containing non-adjacent cells or disjoint blocks. Excel’s processing engine requires a single continuous block of cells for these actions. When code attempts to pass a multi-area selection that lacks uniform row or column alignment, execution halts immediately to prevent data misalignment.
Fast-Fix: The 45-Second Solution
To fix this error, avoid calling bulk commands like
.Copyor.Sortdirectly on non-contiguous ranges (such asRange("A1:A10, C1:C10")). Instead, loop through each individual contiguous block usingFor Each ar In Selection.Areasand processar.Copyindividually, or load the data into a memory array to transfer the contents in a single continuous block.
Quick Risk Snapshot
- Severity Tier: Moderate (halts macro execution and prevents automated data transfers, but does not corrupt underlying data files).
- Is It Safe to Ignore? No. Unhandled halts leave processing loops half-finished and prevent subsequent code steps from running.
- Most Common Cause: Running
.Copy,.Cut, or.Sorton a multi-area range (such as non-adjacent filtered rows or disjoint manual selections). - Rare Cause: Attempting to paste a non-contiguous copied range into an incompatible target destination geometry.
Low Risk vs. High Risk
- If you are performing read-only or formatting operations on small disjoint blocks → Low Risk: The code stops cleanly before data modification occurs, and updating the loop logic resolves the error without risk of data loss.
- If you are running bulk data migrations, automated exports, or multi-sheet sorting loops → High Risk: A mid-process halt leaves destination tables partially updated and leaves environment settings like screen updating locked off.
The Mechanics of the Break
Think of Excel’s memory manager like a single-slot document scanner. If you pass a single rectangular sheet of paper (a continuous cell range like A1:B10), the rollers pull it cleanly. If you try to feed three separate, detached strips of paper side-by-side through the same guide slot at once (a non-contiguous selection like A1:A10, C1:C10), the feeder jams immediately because the guide expects one uniform rectangular outline.
When VBA executes a command like Selection.Copy or Range("A1:A10, C1:C10").Sort, Excel checks the internal memory construct of the range. If the range consists of multiple separated blocks (known in VBA as distinct Areas), Excel blocks the operation unless the areas form a perfectly uniform grid. If the shapes don’t align, the engine raises Runtime Error 1004 to prevent mismatched data insertion.
Probability Breakdown
- Likely (65%): Direct Bulk Operations on Disjoint Ranges. Attempting to call
.Copy,.Sort, or.Deleteon ranges created with commas (e.g.,Range("A1:A5, B10:B15")) or disjointUnion()ranges. - Possible (25%): Operating on Filtered Visible Cells (
SpecialCells(xlCellTypeVisible)). Copying visible rows from an AutoFilter where non-adjacent hidden rows force the visible range into separateAreasof unequal row heights. - Rare (10%): Target Paste Area Contradictions. Trying to paste a multi-selection into a destination range that contains merged cells or restricted layout geometries.
What Escalates the Risk
- Dynamic AutoFilter Operations: When filtering dynamic datasets, hidden rows break contiguous data blocks into dozens of distinct
Areas. A macro that worked fine on small contiguous test datasets breaks as soon as filters split real production data into disjoint ranges. - Manual User Selections: Relying on
Selection.Copywhen end-users holdCtrlto pick non-adjacent cells creates unpredictable range shapes that trigger 1004 errors. - Unrestored System Modes: Halting mid-macro leaves calculation modes set to manual or screen updates suppressed, making Excel appear frozen.
Consequence Timeline
- 24 Hours: Automated reporting macros crash on execution, leaving daily summaries unpopulated or stalling background data processing.
- 1 Week: Workarounds like manual copy-pasting introduce human entry errors, missing rows, and broken audit trails across financial schedules.
- 1 Month: Unhandled macro crashes lead users to disable automation entirely, causing massive backlogs in periodic data reconciliation.
Common Confusion Fix
It is essential to distinguish this multi-selection error from other 1004 runtime variants:
- “That command cannot be used on multiple selections” vs. Size Mismatch Error (Runtime Error 1004: “The information cannot be pasted because the copy area and the paste area are not the same size.”): The multi-selection error happens at the source execution line during
.Copyor.Sorton disjoint ranges. The size mismatch error happens at the destination line when trying to fit a copied block into an incompatible target range. - “That command cannot be used on multiple selections” vs. Failed Range Method (Runtime Error 1004: Method ‘Range’ of object ‘_Worksheet’ failed): The failed range method error occurs when an invalid string address is passed (like
Range("")). The multi-selection error occurs on valid addresses that represent non-adjacent ranges.
What To Do Right Now
- Click Debug on the runtime error dialog to highlight the failing VBA code line.
- Press the Reset button (red square) in the VBA Editor toolbar to halt execution and reset variables.
- Replace bulk single-line operations on non-adjacent ranges with an
Areasloop:VBADim ar As Range For Each ar In MyDisjointRange.Areas ar.Copy Destination:=wsTarget.Cells(nextRow, 1) nextRow = nextRow + ar.Rows.Count Next ar - Save a new version of the workbook before re-running the modified code.
Hard-Stop Triggers
- Macro fails mid-execution while running bulk row or column deletions on production master files.
- Memory exhaustion alerts appear alongside repeated 1004 runtime exceptions during large looping routines.
- Target worksheets contain merged cells that corrupt destination alignments when unmerged automatically.
Professional Audit Path
- Identify Range Geometry: Print
Range.Areas.Countto the Immediate Window (Ctrl + G) to verify if the range contains multiple areas (? Selection.Areas.Count). - Audit Visible Cells Handling: When working with AutoFilter, avoid calling
.CopyonSpecialCells(xlCellTypeVisible)directly if the operation requires pasting as a contiguous block. Loop throughAreasor load data into an array. - Eliminate Selection Reliance: Replace
SelectionandActiveCellreferences with explicitly defined Range variables tied directly to named Worksheets. - Verify Target Contiguity: Ensure destination write targets are clean, unmerged, single-cell references.
Complexity/Repair Range
- Minor (Code Logic Adjustment) — Effort: 5–10 Minutes: Replacing a single
.Copystatement with aFor Each ar In Range.Areasloop. - Moderate (Filter & Array Refactoring) — Effort: 20–45 Minutes: Rewriting AutoFilter copy routines to transfer visible rows into a memory array before writing to target sheets.
- Major (Automation Overhaul) — Effort: 1–2 Hours: Redesigning multi-sheet data consolidation pipelines to remove manual
Ctrlclick selection dependencies and merged cell barriers.
Symptom Escalators
- If your paste command fails because destination grids do not match, see Runtime Error 1004: “The information cannot be pasted because the copy area and the paste area are not the same size.” for resolution steps.
- If your macro breaks when attempting to interact with hidden sheets, refer to Runtime Error 1004: Why you can’t select a range on a Hidden Sheet.
- If the error occurs on protected cells or sheets, check Runtime Error 1004: “The cell or chart you’re trying to change is on a protected sheet.” to unlock permissions programmatically.
- If sorting commands break on multi-column ranges, review Runtime Error 1004: “Sort method of Range class failed” (Key parameter errors).
- For structured error routines, see Using On Error Resume Next vs. On Error GoTo 0 (The right way).
Final Calculation
Runtime Error 1004: “That command cannot be used on multiple selections” occurs because Excel’s engine refuses to execute single-block commands on non-contiguous cell ranges. Resolving it does not require complex redesigns, simply iterate through each contiguous block using For Each ar In Range.Areas or pass data through memory arrays. By replacing reliance on disjoint selections with structured area iteration, your macros will run reliably regardless of how source data is filtered or selected.