VBA copy range

There are a few ways you can copy a range in VBA. For example, you can copy only values or entire cells, including formatting.

Copy a range

The easiest way to copy a bunch of cells is by entering ranges inside the code. The following code will copy the range A1:B8 to D1:E8.

Copy a range to another worksheet

In order to use the following code, you have to create two sheets with the following names: Sheet1 and Sheet2 (or any other, just don’t forget to change it inside the code). The following code copies cells from the range and pastes them into the same range on the other sheet.

Copy a range to another worksheet without formatting

So far we copied entire cells. If you want to copy just values, you can use the following code.

The result will look like this.

Tomasz Decker is an Excel specialist, skilled in data analysis and financial modeling.