In VBA, you paste a range by calling the Paste method on a destination range after copying the source range with Copy. The most common pattern is Range("A1:B10").Copy Destination:=Range("D1"), which copies the source range and pastes it starting at the destination cell in a single statement.
Background: How Range Copy and Paste Works in VBA
Excel's object model exposes copying and pasting through the Range object. When you call Range.Copy without arguments, Excel places the source range on the Clipboard and draws the marching-ants border around it. A subsequent Range.Paste call writes the Clipboard contents into the destination range, using the same rules as the Excel user interface: values, formulas, formats, comments, and data validation are pasted by default, and relative references adjust unless the source formulas use absolute references.
The Destination parameter of Copy combines both steps. Range("A1").Copy Destination:=Range("C1") copies and pastes in one operation without leaving the Clipboard in an indeterminate state. This is the preferred form for most macros because it is shorter, faster, and avoids the flicker and memory overhead of the Clipboard.
Pasting is not the same as assigning values. Range("C1").Value = Range("A1").Value transfers only the value and skips formats, formulas, and comments. Use assignment when you want data only; use Copy/Paste when you need the full fidelity of a normal Excel paste.
Core Syntax and Worked Examples
The building blocks are small, but the variations matter. The table below shows the patterns you will use most often.
- Copy to a destination in one step: Range("A1:B10").Copy Destination:=Range("D1"). The destination is the top-left cell; Excel expands the paste to match the source dimensions.
- Copy, then paste: Range("A1:B10").Copy followed by Range("D1").Paste. Useful when you need to act on the Clipboard between steps.
- Paste values only: Range("A1:B10").Copy then Range("D1").PasteSpecial Paste:=xlPasteValues. This discards formulas and formats and writes only the calculated values.
- Paste formats only: Range("D1").PasteSpecial Paste:=xlPasteFormats.
- Paste with a mathematical operation: Range("D1").PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd adds the copied values to the destination instead of overwriting them.
- Transpose rows and columns: Range("D1").PasteSpecial Paste:=xlPasteAll, Transpose:=True.
- Copy between worksheets: Worksheets("Sheet1").Range("A1:B10").Copy Destination:=Worksheets("Sheet2").Range("A1").
- Copy between workbooks: qualify both the workbook and the worksheet, for example Workbooks("Source.xlsx").Worksheets(1).Range("A1").Copy Destination:=Workbooks("Target.xlsx").Worksheets(1).Range("A1").
A common beginner mistake is writing Range("A1:B10").Copy Range("D1") without the Destination:= label. VBA accepts this because Destination is the first parameter, but the labeled form is clearer and avoids confusion when you later add other arguments.
PasteSpecial: Choosing What Gets Pasted
PasteSpecial is where most real-world range pasting happens, because raw Copy/Paste often brings along formatting you did not want. The Paste argument accepts constants such as xlPasteAll, xlPasteValues, xlPasteFormats, xlPasteFormulas, xlPasteComments, xlPasteValidation, xlPasteColumnWidths, and xlPasteAllExceptBorders. The Operation argument accepts xlNone, xlAdd, xlSubtract, xlMultiply, and xlDivide. The SkipBlanks argument, when True, prevents blank cells in the source from overwriting existing data in the destination. The Transpose argument swaps rows and columns.
Two practical notes. First, xlPasteValues converts formulas to their current results; if the source workbook has not been recalculated, the pasted values reflect the stale calculation. Second, pasting formats only does not change cell contents, so it is safe to apply a source range's look to a destination that already holds data.
Common Problems and How to Fix Them
Most VBA paste errors fall into a handful of categories.
- Runtime error 1004, "Paste method of Worksheet class failed": usually caused by nothing being on the Clipboard, by copying from a protected sheet, or by pasting into a merged cell region that cannot accept the source shape. Check that a Copy ran first and that the destination is not protected.
- Pasting into a smaller range: if the destination range is smaller than the source, Excel pastes only what fits or raises an error depending on the operation. Specify only the top-left destination cell and let Excel expand.
- Clipboard cleared unexpectedly: another application can take ownership of the Clipboard between Copy and Paste. Use the Destination parameter to avoid the gap.
- Formulas break on paste: relative references shift by the offset between source and destination. If you need the exact same formula, use absolute references or paste values.
- Merged cells cause misalignment: pasting into or out of merged ranges often fails. Unmerge before pasting, or paste to an unmerged area first.
- Screen flicker and slow macros: wrap the operation in Application.ScreenUpdating = False and restore it to True afterward. Also set Application.CutCopyMode = False after a Copy/Paste pair to clear the marching ants.
A frequent misconception is that Range.Paste can take a source range as an argument. It cannot; Paste always reads from the Clipboard. The source must be placed there by Copy first, or you must use the Destination parameter of Copy.
Copy/Paste vs. Direct Value Assignment
Choosing between the two approaches is mostly about what you need to preserve. Copy/Paste carries formats, formulas, comments, validation, and column widths, and it respects Excel's own paste rules. Direct assignment, such as Range("D1:D10").Value = Range("A1:A10").Value, is faster for large blocks, does not touch the Clipboard, and cannot trigger Clipboard-related errors. It transfers only values, so it is ideal for data feeds and calculations but wrong when formatting matters. A middle path is to assign .Formula or .FormulaR1C1 when you want formulas without the Clipboard.
Performance and Safety Considerations
For large ranges, Copy/Paste is noticeably slower than value assignment because of Clipboard overhead. If you must paste many blocks, turn off screen updating, avoid selecting ranges, and qualify every Range call with its worksheet. Unqualified Range calls act on the active sheet, which is a common source of bugs when the user switches sheets mid-macro. Always restore ScreenUpdating and EnableEvents in an error handler so a failed paste does not leave Excel in a frozen state. Finally, pasting into a protected sheet raises an error unless the sheet is unprotected first; check protection state before writing.
Frequently Asked Questions
How do I paste only values in VBA?
Copy the source range, then call PasteSpecial Paste:=xlPasteValues on the destination. Alternatively, assign the source's .Value directly to the destination range, which avoids the Clipboard entirely.
Why does my VBA paste fail with error 1004?
The most common causes are an empty Clipboard, a protected destination sheet, or a size or shape mismatch such as pasting into merged cells. Confirm that a Copy ran, unprotect the sheet if needed, and paste to the top-left cell of an unmerged area.
Can I paste a range without using the Clipboard?
Yes. Use Destination:= with Copy, or assign .Value or .Formula directly. Both avoid the Clipboard and are generally faster and more reliable in macros.
How do I copy a range to another worksheet?
Qualify both sides: Worksheets("Sheet1").Range("A1:B10").Copy Destination:=Worksheets("Sheet2").Range("A1"). Include the workbook reference when copying between workbooks.
How do I stop the marching ants after a VBA paste?
Set Application.CutCopyMode = False after the paste. This clears the Clipboard state and removes the animated border around the copied range.