DISCOVER
×

How to Copy Columns in Excel Using VBA

Updated February 21, 2017

Visual Basic for Applications (VBA) is a programming language that comes bundled with Microsoft Office programs, such as Excel. With VBA, you can create macros that will manipulate the Excel spreadsheet, moving the information from one cell to another, or creating formulas in a particular cell. VBA can also copy an entire column of data, so that you can paste it somewhere else.

Open the Excel file. Press Alt and F11 to launch the VBA console window.

Click the module, on the left side of the VBA console, that holds the VBA code you want to work with. Click the right side of the screen to place your cursor in the code where you want to copy your column.

Enter "Columns("A:A").Select" and "Selection.Copy" (without quotes) into the VBA console. Change the "A" to whatever column you want to copy. The two letters may be different, if you want to copy a range of cells between two columns that the letters represent.

Tip

The copy method also allows you to specify a destination for the copied cells. Enter "Destination:=Range("D1")" directly after the copy command, on the same line of code. Change "D1" to the cell or column where you want to paste the copied columns. If you don't include a destination, the column will be copied to the clipboard.

bibliography-icon icon for annotation tool Cite this Article

About the Author

Shawn McClain has spent over 15 years as a journalist covering technology, business, culture and the arts. He has published numerous articles in both national and local publications, and online at various websites. He is currently pursuing his master's degree in journalism at Clarion University.