Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Junior Member
 
Posts: 21
Default Using an Array to Speed-Up Range Copy

I have a large row of formulas (183 cells) in a spreadsheet that I
want to copy a variable number of times (could be as many as 2,000).

My current working code:

With Sheets("WORKPLACE")
.Range(.Cells(5, 4), .Cells(5, 4).Offset(0, 182)).Copy _
Destination:=.Range(.Cells(6, 4), .Cells(totalrows, 4))
End With

My thought is to create a variant array:

vtFormulas =
WorksheetFunction.Transpose(WorksheetFunction.Tran spose(ActiveSheet.Range
_
(Cells(5, 4), Cells(5, 186))))

What is the best way to copy this array down from Cells(6, 4) to
Cells(totalrows, 4)?
I want cell references to change relative to the respective row.

Thanks for a response.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 417
Default Using an Array to Speed-Up Range Copy

With Worksheets("WORKPLACE")
.Cells(5, 4).Resize(totalrows, 183).FillDown
'or
.Range("D5").Resize(totalrows, 183).FillDown
End With
--
Regards,
Bill Renaud



  #3   Report Post  
Posted to microsoft.public.excel.programming
Junior Member
 
Posts: 21
Default Using an Array to Speed-Up Range Copy

Thanks very much, Bill.
I gave up on the variant array and used your code; it appears to be
extremely efficient.
JingleRock


  #4   Report Post  
Posted to microsoft.public.excel.programming
Junior Member
 
Posts: 21
Default Using an Array to Speed-Up Range Copy

I tried to apply your code to copying a single column, with variable
length, to a cell on another worksheet; it did not work. Is this
possible?

JingleRock

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 417
Default Using an Array to Speed-Up Range Copy

In general, to copy a whole sheet of data from one sheet to another, use
code like the following.
Change the names of the worksheets to whatever you need.

Public Sub Test()
Dim wsSource As Worksheet
Dim wsDest As Worksheet
Dim rngSource As Range

Set wsSource = Worksheets("Source")
Set wsDest = Worksheets("Dest")
Set rngSource = wsSource.UsedRange

rngSource.Copy wsDest.Range("A1")
End Sub

--
Regards,
Bill Renaud



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
Copy a range into an array Robert[_32_] Excel Programming 3 July 10th 08 03:23 PM
What is the fastest way to copy a range to a 2D array? equiangular Excel Programming 10 February 12th 07 02:25 PM
copy one array formula to an array range guedj54 Excel Programming 2 October 29th 06 07:38 PM
Copy Range and Paste to Array of Sheets bobwilson[_21_] Excel Programming 4 April 6th 06 01:23 PM
How Can I copy all value of the array into the range? sjoo Excel Programming 0 August 8th 03 07:30 AM


All times are GMT +1. The time now is 04:14 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"