Yes. In Excel for Microsoft 365 on Windows, VBA can copy a complete column with a worksheet’s Columns collection and the Copy Destination argument. Use a fully qualified worksheet reference so the macro copies from and to the sheets you intend.
Basic VBA code to copy a whole column
This example copies column A to column C on a worksheet named Data in the workbook containing the macro. Change the worksheet name or column letters to suit your workbook.
Sub CopyEntireColumn()
Dim ws As Worksheet
' Use the sheet in the workbook that contains this macro.
Set ws = ThisWorkbook.Worksheets("Data")
' Copy all of column A to column C.
ws.Columns("A").Copy Destination:=ws.Columns("C")
End Sub
The Columns collection refers to entire worksheet columns, not just cells with visible data. The destination argument tells Excel where to place the copy, so the macro does not need to select a cell or use the Windows clipboard. Column C’s existing contents are replaced by the copy; check the destination before running the procedure.
Save a copy of the workbook before running any macro. VBA changes cannot be reversed with Ctrl+Z, even when the macro appears to do only one straightforward copy.
What copying an entire column includes
A full-column copy is useful when you need more than the displayed values. A normal copy carries cell contents and commonly associated cell features to the destination. Depending on what is in the source, this can include formulas, formatting, number formats, comments or notes, and data validation. It can also bring along blank cells and formatting far below the visible records, because the selected range is the entire column.
- Formulas: Formulas are copied as formulas. Relative references can adjust for the new position, just as they do when cells are copied in the Excel interface.
- Formatting: Cell formatting is copied along with the cells. Whole-column copying generally carries the column width as well, but set the width separately if an exact width is important to your process.
- Blanks: Blank cells are part of the copied range. This matters if the destination already contains data, because the copy can replace destination cells even where the source looks empty.
Copying is not the same as moving. The source remains in place. Also, a formula that refers to other cells may produce a different result after copying because its relative references shift. If a formula must keep pointing to the same cell, its reference may need dollar signs, such as $A$1, before the copy is made.
Copy between worksheets
When the source and destination are on different sheets, name both sheets in the code. Avoid relying on whichever sheet happens to be active: a macro may be launched while a user is viewing a different tab, and an unqualified Columns("A") reference can then act on the wrong worksheet.
Sub CopyColumnToAnotherSheet()
Dim sourceWs As Worksheet
Dim targetWs As Worksheet
' Identify the source and destination sheets in this workbook.
Set sourceWs = ThisWorkbook.Worksheets("Source")
Set targetWs = ThisWorkbook.Worksheets("Archive")
' Copy all of source column A to destination column D.
sourceWs.Columns("A").Copy Destination:=targetWs.Columns("D")
End Sub
This version assumes both sheets are in the workbook that contains the VBA code. If the sheets are in another open workbook, use a workbook variable to identify that workbook rather than assuming the active workbook is correct. Sheet names must match the workbook tabs, including spaces and punctuation. A missing or misspelled sheet name causes a run-time error instead of copying the intended column.
Copy values only or formulas only
Sometimes you want the results in a column without copying its formulas or formatting. In that case, use Excel’s paste-special operation with the values option. The following example copies the displayed results from Source column A into Archive column D; it does not retain the source formulas or cell formatting.
Sub CopyColumnValuesOnly()
Dim sourceWs As Worksheet
Dim targetWs As Worksheet
' Set the two worksheets explicitly.
Set sourceWs = ThisWorkbook.Worksheets("Source")
Set targetWs = ThisWorkbook.Worksheets("Archive")
' Copy the column, then paste its values only.
sourceWs.Columns("A").Copy
targetWs.Columns("D").PasteSpecial Paste:=xlPasteValues
' Clear Excel's copy marquee and clipboard mode.
Application.CutCopyMode = False
End Sub
Paste Special uses the clipboard, unlike the one-line Copy Destination approach, so clearing Application.CutCopyMode at the end is a useful cleanup step. To copy formulas without the source formatting, use the corresponding xlPasteFormulas paste type. Choose the paste type deliberately: values-only is appropriate for a snapshot, while a live formula-based result needs formulas or a different design.
Entire column or just the used data?
A worksheet column in current Excel versions contains 1,048,576 rows. Copying a whole column is convenient when the destination should be a full-column duplicate, when future entries may be added anywhere in the column, or when the column’s formatting and structure matter. It can be excessive if the actual list contains only a few hundred records.
For a large workbook, consider limiting the copy to the rows that contain relevant data. A bounded range reduces the amount of material Excel must process and avoids overwriting unrelated cells farther down the destination. The correct last-row method depends on the layout: a key field that is always filled may identify the records, but a column with intentional gaps may not. Excel’s UsedRange can also include cells that were formatted and later cleared, so it is not always a reliable measure of the meaningful data boundary.
Before changing a full-column macro to a smaller range, decide whether it must include the header, blank rows, formulas below the current records, or rows that may be added later. Those requirements determine whether a fixed range, a table’s data area, or a last-used-row calculation is appropriate. Do not assume that copying only the visibly populated cells will preserve every formatting or validation rule used elsewhere in the column.
Common errors and ways to avoid them
- Wrong active sheet: Qualify every source and destination with a worksheet variable. This makes the macro’s target explicit and avoids accidental dependence on the current tab.
- Destination data is overwritten: Copying to a whole destination column replaces its existing contents. Inspect the destination or write the macro to a clearly designated blank column.
- Formula results change: Relative references adjust when copied to a different position. Check whether the formula should move with the copy or retain fixed references.
- Unexpectedly large or slow operation: Entire columns include more than the visible records. If the task concerns a bounded dataset, copy only that data area where practical.
- Sheet-name error: A worksheet name in code must match the tab name. Renaming a tab after writing the macro can make the reference fail.
- Macro cannot be undone: Ctrl+Z does not reverse VBA changes. Save a separate copy before running the macro, especially when it replaces a populated column.
A useful safeguard is to check that the source and destination are not accidentally the same column, and to make the destination sheet explicit. For a macro used repeatedly by other people, add checks for missing sheets and show a confirmation before replacing existing data. Keep those checks specific to the workbook: a generic confirmation does not substitute for verifying that the correct sheet and column are named.
Run the macro and consider platform limits
On Excel for Microsoft 365 on Windows, save a macro-enabled workbook as an .xlsm file if you want to keep the VBA code in that file. Open the Visual Basic Editor with Alt+F11, insert or choose a standard module, and place the procedure there. You can run a selected procedure from the editor or use Developer > Macros, select its name, and choose Run. If the Developer tab is hidden, enable it through Excel Options > Customize Ribbon.
Excel for Mac supports VBA, though editor shortcuts can depend on the keyboard and function-key settings; Option+F11 opens the Visual Basic Editor on many Mac keyboards, and you may need to hold Fn as well. The basic worksheet-copy code shown here uses standard Excel object-model features, but macros that rely on Windows-specific libraries or file paths may need changes on Mac. Excel for the web does not run VBA macros; open the workbook in the desktop application to run this code.
Only enable macros in files you trust. A workbook can contain VBA that does more than copy data, so inspect the code or obtain it from a trusted source. Keep a backup before execution: macros cannot be undone with Ctrl+Z on Windows or the equivalent undo command on Mac.
When another approach is better
VBA is useful when the copy is part of a repeatable workflow, needs to run from a button, or must be combined with other workbook actions. For a one-off task, selecting the column heading, copying, and pasting in Excel may be simpler. You can select a complete column by clicking its letter at the top of the worksheet; use the destination column’s heading when the whole column is meant to be replaced.
If the goal is to keep a destination synchronized with a source rather than make a one-time copy, a formula reference or a structured Excel table may be more suitable. If the goal is to move or transform imported data repeatedly, Power Query can be a better fit than a macro. The choice depends on whether you need a one-time duplicate, fixed values, continuing formulas, or an automated repeatable process—not simply on whether VBA can perform the copy.
Frequently Asked Questions
How do I copy an entire column in VBA without selecting it?
Use the worksheet’s Columns collection and the Copy Destination argument, as in the first macro. Explicitly qualify the worksheet so the result does not depend on the active tab.
Does VBA copy column formatting too?
A normal whole-column copy includes cell formatting as well as contents and formulas. If you only want values, use Paste Special with xlPasteValues; that avoids transferring the source formatting.
How do I copy a column to another sheet?
Set a Worksheet variable for the source sheet and another for the destination sheet, then copy the source column to the target column. Make sure both sheet names match the workbook tabs.
Can I copy only the values from a column?
Yes. Copy the source column and paste it with xlPasteValues, as shown above. The destination receives the calculated results rather than the source formulas.
Why can’t I undo a VBA column copy?
Excel clears its normal undo history when a macro makes changes. Save a copy of the workbook before running a macro that may overwrite data, because Ctrl+Z cannot reverse the VBA operation.
Related
- Excel Page Break Keyboard Shortcut and How to Use It
- Excel Page Break Lines: How to View and Remove Them
- Excel Page Break Lines Won’t Go Away? How to Hide Them
Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.
More in VBA & macros
- Excel VBA to List File Names in All Subfolders AutomaticallyTo list file names from a folder and all its subfolders in Excel for Microsoft 365 on Windows,…
- Excel VBA Find Text in a String: InStr ExplainedIn Excel VBA, use the InStr function to find one piece of text inside another: it returns the…
- Excel VBA: How to Copy a Module to Another WorkbookTo copy an Excel VBA module to another workbook, open both files in desktop Excel, press Alt+F11, and…
- How to Copy and Paste VBA Code into ExcelTo copy and paste VBA code into Excel, open the Visual Basic Editor, insert a standard module, paste…
- Excel VBA: Delete a Row and Shift UpTo delete a complete worksheet row in Excel VBA and move the rows below it up, use Rows(rowNumber).Delete,…
- Excel VBA Find the First Empty RowTo append data after the last entry in a known column, use Cells(Rows.Count, "A").End(xlUp).Row + 1, with a…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.