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 |
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 |
All times are GMT +1. The time now is 09:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com