Written by Allen Wyatt (last updated January 31, 2026)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365
Szilvia can create a selection set of cells, such that she has a non-contiguous range of cells selected. If she tries to copy those cells using Ctrl+C, Excel informs her that "this action will not work on multiple selections." Szilvia wonders if there a way to copy a non-contiguous range and then paste that range so that the cells are in the same relative position as in the original selection.
Apparently, this limitation of only allowing you to copy and paste contiguous ranges is the way that Excel is designed to work. The only way you can copy and paste a non-contiguous range is to use a macro—one that steps through each area in a selection and pastes it relative to a target address.
There is one exception to this limitation, however. If your non-contiguous selection consists of ranges that all come from the same rows, you can copy and paste them using the standard Ctrl+C and Ctrl+V commands. For example, if you select the range A13:D16, then hold Ctrl and select F13:G16, you can copy and paste these ranges. The pasted data will appear in adjacent columns in the destination. This works because the rows are aligned across all selected areas.
For all other cases where the non-contiguous ranges are not row-aligned, you will need to use a macro. The following macro provides a robust solution:
Sub CopyPasteCells()
Dim Area As Range
Dim PasteRng As Range
Dim C As Integer
Dim R As Double
Dim X As Integer
Dim Y As Double
On Error Resume Next
Set PasteRng = Application.InputBox("Target cell?", Type:=8)
If PasteRng Is Nothing Then Exit Sub
On Error GoTo 0
C = Selection.Column
R = Selection.Row
For Each Area In Selection.Areas
X = Area.Column
If X < C Then C = X
Y = Area.Row
If Y < R Then R = Y
Next Area
C = PasteRng.Column - C
R = PasteRng.Row - R
For Each Area In Selection.Areas
Area.Copy Cells(Area.Row + R, Area.Column + C)
Next Area
Application.CutCopyMode = False
End Sub
This macro works by using VBA's Areas collection to copy each contiguous block of the selection at a time, which is faster than copying cell by cell. It correctly calculates the relative position of each area and pastes it in the proper location relative to the target cell you specify.
To use the macro, create your selection set of cells (holding Ctrl while clicking to select non-contiguous ranges). Then, run the macro and specify the target cell for the pasting. Excel displays an input box where you can either type the cell address or click directly on the target cell. The cells are pasted relative to that target cell on the current worksheet, maintaining their original spacing and positions.
If you need to cut and paste (rather than copy and paste), you can modify the macro by changing Area.Copy to Area.Cut in the second For Each loop.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (5228) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 365 applications with VBA programming. Written in clear terms and understandable language, the book includes systematic tutorials and contains both intermediate and advanced content for experienced VB developers. Designed to be comprehensive, the book addresses not just one Office application, but the entire Office suite. Check out Mastering VBA for Microsoft Office 365 today!
Using the AutoFill feature of Excel is very handy. If you want to expand the utility offered by the feature, all you need ...
Discover MoreThe PROPER worksheet function allows you to change the case of text so that only the first letter of each word is ...
Discover MoreDo you need to flag duplicate values in your data? This tip shows three different ways you can do the flagging you need.
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2026-02-02 10:08:11
J. Woolley
The Tip's macro is very clever, but it fails when PasteRng (i.e., "Target cell") is not on the active worksheet. To fix the problem, replace the following statement
Area.Copy Cells(Area.Row + R, Area.Column + C)
with this statement
Area.Copy PasteRng.Worksheet.Cells(Area.Row + R, Area.Column + C)
This works even if PasteRng is on a worksheet that is not part of the active workbook (but is part of an open workbook).
Finally, if you want to make sure the pasted result is visible, add these statements before 'End Sub'
PasteRng.Worksheet.Activate
PasteRng.Show
As noted by Tomek, the Tip says:
"If your non-contiguous selection consists of ranges that all come from the same rows, you can copy and paste them using the standard Ctrl+C and Ctrl+V commands."
This should be modified as follows:
"If your non-contiguous selection consists of ranges that all come from the same rows or from the same columns (or both), you can copy and paste them using the standard Ctrl+C and Ctrl+V commands."
2026-01-31 12:05:41
Tomek
Re: There is one exception to this limitation, however. If your non-contiguous selection consists of ranges that all come from the same rows, you can copy and paste them using the standard Ctrl+C and Ctrl+V commands
The exception is a little wider: if your non-contiguous selection cells form a rectangular matrix, such that the selected cells would for a fully populated rectangle when all non-selected cells were hidden, then such block of cells can be copied and pasted as a single rectangular block. There is one additional requirement that is best illustrated by example: if you select a block of three cells in one row, then all selections from rows below have to be three cells wide in the same columns, i.e., you cannot select three-cells block one row and three individual cells below. All selected areas have to match the height of other areas to the right and the width of the areas below.
This copy and paste functionality is important when you want to extract data after filtering them, or after hiding some rows and/or columns.
The limitation is that the non-selected rows and columns are ignored and the selected cells are collapsed into a single area.
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2026 Sharon Parq Associates, Inc.
Comments