Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default pasting data from an array

I want to use a macro to copy data from the same cell in all worksheets and
then paste it row by row in the active worksheet.
I'm okay for the code to select and copy, I'm currently using an array
(don't know if there is a smarter way).
However could someone give me some pointers on the code to use for pasting
in the active sheet row by row. Without have to have a line of code for each
worksheet.
Cheers Laura
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default pasting data from an array

You can paste in many ways, some more efficient than others. If you
have the contents of each of the key cells in a 2 dimensional array you
can declare a range with the same dimensions on the activesheet and
paste with .Value For example:

Dim rngDest as Range

Set rngDest = ActiveSheet.Range("A1:A5") 'Presuming your array is 5 by
1
rngDest.Value = yourArray

Or if you must go row by row:

Dim rngCell as Range
Dim rngDest as Range
Dim iCount as Integer

Set rngDest = ActiveSheet.Range("A1:A5")
iCount = LBound(yourArray, 1)
For each rngCell in rngDest
rngCell.Value = yourArray(iCount)
iCount = iCount + 1
Next rngCell

HTH

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
Pasting an Excel array ram Excel Programming 11 December 23rd 05 02:21 PM
VBA pasting array into cells Jeff Excel Discussion (Misc queries) 1 December 6th 05 01:58 AM
Pasting on Filtered Data Sheets without pasting onto hidden cells CCSMCA Excel Discussion (Misc queries) 1 August 28th 05 01:22 PM
Pasting an array into a range Tony Excel Programming 4 January 7th 05 12:24 AM
Pasting a portion of an array ww Excel Programming 2 September 6th 04 03:46 AM


All times are GMT +1. The time now is 11:38 PM.

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

About Us

"It's about Microsoft Excel"