Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying cell contents between worksheets
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying cell contents between worksheets
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 "Stuart" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copying format to a new cell, w/o overwriting destination cell contents | Excel Discussion (Misc queries) | |||
Copying cell contents to a list | New Users to Excel | |||
If Statement and copying all of cell contents. | Excel Worksheet Functions | |||
Copying Cell Contents throughout spreadsheet | Excel Programming | |||
Copying cell contents to add to existing contents in another cell | Excel Programming |