VBA Copy Range to Another Sheet + Workbook


- Written by Puneet

To copy a cell or a range of cells to another worksheet you need to use the VBA’s “Copy” method. In this method, you need to define the range or the cell using the range object that you wish to copy and then define another worksheet along with the range where you want to paste it.

Copy a Cell or Range to Another Worksheet

Range("A1").Copy Worksheets("Sheet2").Range("A1")
  1. First, define the range or the cell that you want to copy.
    define the range or cell
  2. Next, type a dot (.) and select the copy method from the list of properties and methods.
    type a dot and select the copy method
  3. Here you’ll get an intellisense to define the destination of the cell copied.
    define the destination of the copied cell
  4. From here, you need to define the worksheet and then the destination range.
    define the worksheet and than destination range

Now when you run this code, it will copy cell A1 from the active sheet to the “Sheet2”. There’s one thing that you need to take care that when you copy a cell and paste it to a destination it also pastes the formatting there.

But if you simply want to copy the value from a cell and paste it into the different worksheets, consider the following code.

Worksheets("Sheet2").Range("A1") = Range("A1").Value

This method doesn’t use the copy method but simply adds value to the destination worksheet using an equal sign and using the value property with the source cell.

Copy Cell from a Different Worksheet

Now let’s say you want to copy a cell from a worksheet that is not active at the time. In this case, you need to define the worksheet with the source cell. Just like the following code.

Worksheets("sheet1").Range("A1").Copy Worksheets("Sheet2").Range("A1")

Copy a Range of Cells

Range("A1:A10").Copy Worksheets("Sheet2").Range("A1:A10")
Range("A1:A10").Copy Worksheets("Sheet2").Range("A1")

Copy a Cell to a Worksheet in Another Workbook

When workbooks are open but not saved yet.

Workbooks("Book1").Worksheets("Sheet1").Range("A1").Copy _

When workbooks are open and saved.

Workbooks("Book1.xlsx").Worksheets("Sheet1").Range("A1").Copy _

Copy a Cell to a Worksheet in Another Workbook which is Closed

'to open the workbook that is saved in a folder on your system _
change the path according to the location you have in your _
Workbooks.Open "C:UsersDellDesktopmyFile.xlsx"

'copies cell from the book1 workbook and copy and paste _
it to the workbook myFile
Workbooks("Book1").Worksheets("Sheet1").Range("A1").Copy _

'close the workbook and after saving
Workbooks("myFile").Close SaveChanges:=True

Related: How to Open a Workbook using VBA in Excel

Last Updated: June 22, 2023