[toc]


About This Tutorial: You will learn several different methods to Copy & Paste and Cut & Paste using a VBA macro.

To use this code: Open the Visual Basic Editor (Alt + F11), Insert a new module (Insert > Module) and copy & paste the desired code into the module.

Copy (Cut) and Paste a Single Cell

This example copies or cuts and pastes a single cell, A1 over to B1:

Copy Selection

If you want to copy the active selection use this:

Copy (Cut) and Paste a Range of Cells

This example copies or cuts and pastes a range of cells, A1:A3 over to B1:B3 :

Copy (Cut) and Paste an Entire Column

This example copies or cuts and pastes an entire column, A over to B:

Copy (Cut) and Paste an Entire Row

This example copies or cuts and pastes an entire row, 1 over to 2:

Copy (Cut) and Paste to Another Worksheet or Workbook

Value Paste

Normally, when you Copy and Paste you Paste all the properties of a cell: formatting, formulas, etc.. Value Pasting allows you to Copy and Paste cells’ values and nothing else. The easiest way to Value Paste in VBA is to define the cell’s value directly:

Paste Special

Paste Special allows you to Copy and Paste specific properties of cells (examples: formats, values, column widths, etc.). It also allows you to perform special paste operations (examples: skip blanks, transpose). We will look at several examples below.

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about Easy VBA. A VBA add-in to quickly insert any of the sample code found on our site directly into the Visual Basic Editor, save your own frequently used code, and more!

alt text

Stop searching for VBA code online. Try the Code VBA Add-in…

Learn More!


<<Return to VBA Examples

Did you find this VBA tutorial useful? Then share it with your friends and colleagues: