Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / December 2007

Tip: Looking for answers? Try searching our database.

Which is faster, copying range to another set of ranges or copying to     memory?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
axwack - 11 Dec 2007 18:01 GMT
I am working with real time data and came across a problem where if
you the data is changing and you are trying to operate on the data,
you will get an automation problem. My solution, is to snapshot the
data, set it off to the side and then insert that data into a
database. This seems to work because a selection of range stops RTD
feeds.

I'm trying to get the fastest throughput possible. Would it be better
to operate on an in-memory array and then insert into the database or
copy/paste values to another set of cells and then operate on the
data?
Jim Rech - 11 Dec 2007 19:40 GMT
>>Would it be better to operate on an in-memory array and then insert into
>>the database or
copy/paste values to another set of cells and then operate on the data?

In memory ops are almost always faster than spreadsheet ops.

Sub SheetOp()
   Dim StartTime As Double
   Dim Counter As Long
   StartTime = Timer
   For Counter = 1 To 10000
       Cells(Counter, 1).Value = Cells(Counter, 1).Value + 1
   Next
   MsgBox Timer - StartTime
End Sub

Sub MemoryOp()
   Dim StartTime As Double
   Dim Counter As Long
   Dim Arr As Variant
   StartTime = Timer
   Arr = Range("A1:A10000").Value
   For Counter = 1 To 10000
       Arr(Counter, 1) = Arr(Counter, 1) + 1
   Next
   Range("A1:A10000").Value = Arr
   MsgBox Timer - StartTime
End Sub

Signature

Jim

|I am working with real time data and came across a problem where if
| you the data is changing and you are trying to operate on the data,
[quoted text clipped - 7 lines]
| copy/paste values to another set of cells and then operate on the
| data?
axwack - 12 Dec 2007 13:19 GMT
> >>Would it be better to operate on an in-memory array and then insert into
> >>the database or
[quoted text clipped - 38 lines]
> | copy/paste values to another set of cells and then operate on the
> | data?

Jim,

Thank you...you certainly put that one to bed.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.