In VBA, specify the destination range with the Destination argument of Range.Copy: for example, Worksheets("Data").Range("A1:C5").Copy Destination:=Worksheets("Report").Range("E1"). The destination is the top-left cell where the copied range should begin; Excel places the copied cells from there, including their formulas and formatting.
What “destination” means in VBA
A copy operation has two parts: the source range to copy and the target location to receive it. In VBA, the target is commonly called the destination. The Copy method can take a destination range directly, which makes the operation explicit and avoids relying on whichever cell happens to be selected.
For example, if the source is A1:C5 and the destination is E1, the copied block occupies E1:G5. You normally provide the destination’s upper-left cell rather than building a separate target range of exactly the same size. Make sure there is enough room for the copied block and that you are not unintentionally overwriting data there.
This is different from copying with the keyboard. When a person presses Ctrl+C and then Ctrl+V, Excel uses the clipboard and the active selection to decide where to paste. A macro can use that same clipboard approach, but a direct destination argument is often simpler and less vulnerable to selection changes.
Basic syntax and a complete example
The general pattern is sourceRange.Copy Destination:=destinationRange. The source and destination can be ranges on the same worksheet or on different worksheets. Qualifying each range with its worksheet makes the code clearer and prevents Excel from interpreting an unqualified range on the wrong active sheet.
Before running a macro, save a copy of the workbook. VBA changes cannot be reversed with Ctrl+Z after the macro has run. This example copies a block from one sheet to another in the workbook containing the code:
Sub CopyBlockToReport()
' Copy a block from Data to Report.
Dim source As Range
Dim target As Range
Set source = ThisWorkbook.Worksheets("Data").Range("A2:C10")
Set target = ThisWorkbook.Worksheets("Report").Range("E2")
source.Copy Destination:=target
End Sub
Here, A2:C10 contains nine rows and three columns, so the result starts at E2 and fills E2:G10. The macro expects worksheets named Data and Report to exist in the workbook that contains the VBA code. If a sheet has a different name, change the quoted name to match its tab exactly.
To run a macro from the Visual Basic Editor, place the cursor inside the procedure and choose Run > Run Sub/UserForm; F5 is the Windows shortcut. On a Mac, the function-key behavior can depend on keyboard settings, so use the Run menu if F5 does not run the procedure. For ordinary manual copying in Excel, use Ctrl+C and Ctrl+V on Windows, or Command+C and Command+V on Mac.
Choosing the right destination range
The destination should identify the cell where the upper-left corner of the copied block belongs. For a one-cell source, the destination is simply the cell to fill. For a multi-cell source, Excel carries the full source dimensions from that starting point. If the source is B2:D4 and the target begins at F7, the copied block fills F7:H9.
A destination on another sheet needs that worksheet named explicitly, as in Worksheets("Summary").Range("B3"). You can also qualify a sheet with its workbook. Use ThisWorkbook when the source or target is in the workbook containing the VBA code. Use a workbook variable or a fully qualified workbook reference when the macro is meant to operate on a different open workbook.
For a destination that depends on a variable, declare and assign the range before copying. For example, a macro can set the target to the first cell of a report area, then copy to it. Avoid relying on ActiveCell unless the user’s current selection is deliberately part of the workflow. Selection-dependent code can paste into an unexpected location when another sheet or window is active.
- Fixed address: use a direct reference such as
Range("E2")when the layout is stable. - Different worksheet: qualify both source and target with their worksheet names.
- Changing data size: calculate the source range based on the actual last row, then use its first cell as the destination.
- Different workbook: qualify the range through the correct workbook object, not just a sheet name.
What gets copied, and when to copy values only
Range.Copy Destination:=... performs a normal Excel copy. It can transfer cell values, formulas, formatting, and other cell-level content, rather than limiting the operation to displayed values. Formulas adjust their relative references in the usual way when placed at a different location. For example, a formula referring to the cell immediately above may update to refer to the cell above its new position.
If the goal is to transfer only calculated results, a direct value assignment is often more suitable than copying. It does not use the clipboard and does not bring over formatting or formulas. The source and destination ranges should have the same dimensions. Save a copy before running this macro too, because its assignment overwrites the target cells and cannot be undone with Ctrl+Z.
Sub CopyValuesOnly()
' Assign results without copying formulas or formatting.
Dim source As Range
Dim target As Range
Set source = ThisWorkbook.Worksheets("Data").Range("A2:C10")
Set target = ThisWorkbook.Worksheets("Report").Range("E2:G10")
target.Value2 = source.Value2
End Sub
Using .Value2 transfers the underlying values, including the results currently returned by formulas, but leaves the target’s existing number formats in place. If the target is formatted as General, a date value may appear as a serial number; apply an appropriate number format if you need it to display as a date. If you need formulas or source formatting, use the normal copy method instead.
Using PasteSpecial for selected content
Sometimes you want a normal copy but only one part of it, such as values or formats. In that case, use Copy followed by PasteSpecial. This method uses Excel’s copy state, so clear it afterward if you do not want the moving copy border to remain. As with any macro that changes cells, save a workbook copy before running it.
Sub PasteValuesWithPasteSpecial()
' Copy source cells, then paste only their values.
Dim source As Range
Dim target As Range
Set source = ThisWorkbook.Worksheets("Data").Range("A2:C10")
Set target = ThisWorkbook.Worksheets("Report").Range("E2")
source.Copy
target.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End Sub
Here, the target is the top-left cell and Excel places the copied block from that point. The xlPasteValues option pastes values rather than formulas and formatting. Other built-in paste types are available, but choose one that matches the content you actually need. For a straightforward values-only transfer between equal-sized ranges, direct .Value2 assignment is usually easier to read and does not involve the clipboard.
Copying to another workbook
Copying between workbooks follows the same principle, but both workbook references need to point to the intended files. For example, a macro can refer to ThisWorkbook.Worksheets("Data") for the source and to a worksheet in another workbook variable for the target. The other workbook must be open if the code uses an existing workbook object.
Workbook names and sheet names are not interchangeable. A sheet name identifies a tab within a workbook; the workbook object identifies the file. If you only write Worksheets("Report"), VBA generally resolves it through the active workbook, which may not be the file you intended. Explicit references reduce that risk, especially when several workbooks are open.
When you need to move data to a workbook that may not be open, the macro must open or otherwise obtain that workbook before addressing its worksheet. Account for the possibility that the file is missing, already open under a different name, or read-only. For repeatable automation, validate that the expected workbook and sheet are available before making changes.
Common problems and how to avoid them
A frequent mistake is assuming that the destination must be the same size as the source when using Copy Destination:=. Usually, pass the upper-left target cell and let Excel place the full copied block. For direct value assignment, however, use equally sized source and target ranges so that the transferred array fits the target as intended.
- Subscript out of range: check that the worksheet name is spelled correctly and that it belongs to the workbook reference used in the code.
- Unexpected paste location: replace unqualified ranges,
Select, orActiveCellwith explicit worksheet and range references. - Overwritten information: confirm the destination block is clear or that replacing its contents is intended. A copy does not automatically insert cells and shift existing data out of the way.
- Wrong appearance: normal copying brings formatting; values-only assignment does not. Choose the method according to whether you need formulas, formats, or just results.
- Unexpected formula references: relative references adjust when copied. Use absolute references in the source formula when a reference must remain fixed.
- PasteSpecial error or lingering copy border: ensure a copy has occurred before PasteSpecial, then set
Application.CutCopyMode = Falsewhen finished.
Merged cells and filtered lists can also make results less intuitive. Copying into a merged area may require source and destination merge layouts to be compatible. When a worksheet is filtered, a simple rectangular range can include rows that are hidden by the filter; do not assume that a normal range copy means “visible rows only.” If the requirement is specifically to copy visible cells, handle that case deliberately and verify the chosen range before writing to the destination.
Direct copy versus selecting and pasting
Code that selects the source, copies it, selects the destination, and pastes can work, but it is usually longer and more fragile. The active sheet can change, another workbook can become active, or an event handler can affect the selection. A direct statement such as source.Copy Destination:=target avoids those unnecessary steps and makes the intended source and destination visible in one place.
Selection may still be useful when a macro is designed to show the user what it is doing or when a particular Excel command requires an active selection. For routine range transfer, however, object references are clearer. They also make it easier to maintain code: changing the destination address means changing the target assignment, not several separate selection and paste instructions.
Frequently Asked Questions
How do I copy a range to another sheet in VBA?
Qualify the source and destination with their worksheet names, then use source.Copy Destination:=target. For example, copy Worksheets("Data").Range("A1:B5") to Worksheets("Report").Range("D1").
Does VBA Copy Destination paste formulas and formatting?
Yes. It behaves like a normal Excel copy, so it can carry formulas, values, and formatting. Relative formula references adjust for the new location.
How do I paste values only without using the clipboard?
Set equal-sized ranges and assign target.Value2 = source.Value2. This transfers results as values, not formulas or formatting. Make sure the target’s number format is suitable for those values.
Can I copy to a different workbook?
Yes. Reference the source and destination through the correct workbook and worksheet objects. The target workbook must be open if your code is using its workbook object.
Why does my VBA copy go to the wrong cell?
The code may be using an unqualified range, ActiveCell, or a selected sheet that changed. Set explicit source and target ranges and qualify them with the intended workbook and worksheet.
Can I undo a VBA copy with Ctrl+Z?
Usually not. Running a macro clears Excel’s normal undo history, so save a separate copy of the workbook before running code that changes cells.
Related
- Remove a Dropdown List in Excel Without Losing Data
- Excel Redo Shortcut: How to Restore an Undone Action
- Protect Excel Sheets in Teams: What It Does and How
Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.
More in VBA & macros
- How to Add Macros to Google Sheets and Automate TasksTo add a macro in Google Sheets, open the spreadsheet in a desktop web browser, choose Extensions >…
- VBA Range Filter: How to Use AutoFilterTo filter a worksheet range with VBA in Excel for Microsoft 365 on Windows, call the range’s AutoFilter…
- Access VBA: Find a Character in a StringIn Access VBA, use InStr to find a character or substring: it returns the character’s 1-based position, or…
- Can Google Sheets Run Excel Macros? Key DifferencesNo. Google Sheets cannot run Excel VBA macros. It has its own automation tools—Google Apps Script and a…
- Excel VBA Find and Replace: Methods and ExamplesTo find and replace text with Excel VBA, use the Range.Replace method and specify what to search for,…
- Excel Macro Keyboard Shortcuts: Assign and Run MacrosIn Excel for Microsoft 365 on Windows, assign a macro shortcut by choosing Developer > Macros, selecting the…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.