Copying and Pasting Non-Contiguous Ranges of Cells

Written by Allen Wyatt (last updated January 29, 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:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

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.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Formatting In Your Outline

Don't like the formatting that appears when looking at your document in Outline view? You can turn off the formatting and ...

Discover More

Finding a Change in Typeface

When you format a document, you can go so far as to change the font of each character in the document. This may be ...

Discover More

Stopping a Checked Box from being Unchecked

When creating user forms for use in Excel, you are provided with a range of controls you can add, including check boxes. ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Separating a Date into Component Columns

Do you need a way to split dates out into the individual parts that make up that date? This tip provides two easy ways ...

Discover More

Entering Numbers in Excel

Enter information into a cell, and Excel needs to figure out what type of information it is. Here's how Excel interprets ...

Discover More

Selecting Formulas

Want to select only the formulas in your worksheet? It's easy to do using the Go To Special dialog box.

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 - 2?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

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.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.