Copying and pasting multiple selections in Excel using VBA can be a powerful way to automate tasks within your spreadsheets. It enables you to efficiently duplicate data, formats, or formulas across different areas of your workbook. This tutorial will guide you through the process of using VBA to copy and paste multiple selections.
Steps
Before diving into the code, ensure you have your Excel workbook open with the source and target cells ready for the copy-and-paste operation.

1. Define the Range of Objects
Firstly, you need to define the range of cells that you want to copy from and the range where you want to paste the data. In VBA, this is done by creating Range objects:
1 2 3 4 |
Dim sourceRange As Range Dim targetRange As Range Set sourceRange = ThisWorkbook.Sheets("Sheet1").Range("A1:A10") Set targetRange = ThisWorkbook.Sheets("Sheet1").Range("B1") |
2. Copy and Paste the Data
Once you’ve defined the source and target ranges, you can use the Copy
method of the Range object to copy the data
1 |
sourceRange.Copy |
After copying, you’ll paste the data into the target cell or range using the PasteSpecial
method
1 |
targetRange.PasteSpecial Paste:=xlPasteValues |
The PasteSpecial
method enables you to specify exactly what you want to paste. For instance, you could paste only the values, formulas, or formatting.
3. Multi-Range Selection
In scenarios where you have multiple discontinuous ranges to copy, you can combine them into one range using the Union method.vba
1 2 |
Set multiSourceRange = Union(ThisWorkbook.Sheets("Sheet1").Range("A1:A10"), _ ThisWorkbook.Sheets("Sheet1").Range("C1:C10")) |
Similarly, you can use the PasteSpecial
method to paste the combined ranges into a target range.
4. Clear Clipboard
After the copy and paste operation, it is often a good idea to clear the clipboard to prevent any unintended pasting later:
1 |
Application.CutCopyMode = False |
Full Code
Below is the full VBA code that demonstrates how to copy and paste multiple selections in Excel:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
Sub CopyAndPasteMultipleSelections() Dim sourceRange As Range Dim targetRange As Range Dim multiSourceRange As Range Dim area As Range ' Define single source and target ranges Set sourceRange = ThisWorkbook.Sheets("Sheet1").Range("A1:A10") Set targetRange = ThisWorkbook.Sheets("Sheet1").Range("B1") ' Copy from source to target sourceRange.Copy targetRange.PasteSpecial Paste:=xlPasteValues ' Define multiple source ranges using Union Set multiSourceRange = Union(ThisWorkbook.Sheets("Sheet1").Range("A1:A10"), _ ThisWorkbook.Sheets("Sheet1").Range("C1:C10")) ' Loop through each area in the multiSourceRange and copy to target For Each area In multiSourceRange.Areas area.Copy targetRange.Offset(0, area.Column - multiSourceRange.Column).PasteSpecial Paste:=xlPasteValues Next area ' Clear the clipboard Application.CutCopyMode = False End Sub |
Ensure that you run this code in the Excel VBA editor. You can access the editor by pressing ALT + F11
in Excel.
Result

Conclusion
With this tutorial, you have learned how to use Excel VBA to copy and paste multiple selections. You can define the range of cells to manipulate, use Copy
and PasteSpecial
methods to move data around and clear the clipboard when done.
Remember that VBA is a powerful tool, and with these techniques, you can significantly enhance your productivity by automating repetitive tasks in Excel.