Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying format to a new cell, w/o overwriting destination cell contents James C Excel Discussion (Misc queries) 1 October 18th 05 08:02 PM
Copying cell contents to a list Peter Horrocks New Users to Excel 3 October 1st 05 10:15 PM
If Statement and copying all of cell contents. andrewm Excel Worksheet Functions 0 June 29th 05 04:37 AM
Copying Cell Contents throughout spreadsheet kaytee978 Excel Programming 3 June 2nd 04 09:12 PM
Copying cell contents to add to existing contents in another cell Dean Sawas Excel Programming 3 April 2nd 04 09:00 PM


All times are GMT +1. The time now is 11:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"