Copying cell contents between worksheets

  • Thread starter Thread starter Stuart
  • Start date Start date
S

Stuart

I would like to be able to copy the contents of a cell
from one worksheet to another via script, without having
to switch to the worksheet that I'm copying the data from.

Please advise how this can be done.

All assistance greatly appreciated.

Stuart Bazzard
Cape Town
South Africa
 
The easiest method is to literally assign cell values across by referencing
the sheets and range.

Sheets("Sheet1").Range("A1").Value = Sheets("Sheet2").Range("A1").Value

The above copies the value from sheet 2, cell A1 into sheet 1, cell A1. It
involves no sheet or cell activation and neither of the source or
destination sheets need be selected.

Another method using Cells, allows for the row and column to be specified
numerically, this is useful if you want to control the copying in a loop
(the first number in the Cells(r,c) is the row the second the column).

Sheets("Sheet1").Cells(1, 1).Value = Sheets("Sheet2").Cells(1, 1).Value

Cheers
Nigel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top