Solved

Store results in memory instead of each time writing results in sheet(cell).

Posted on 2012-12-27
3
182 Views
Last Modified: 2013-01-11
Dear,

I'm including some accuracy control mechanism in a simulation Tool I build to re-rate made mobile calls.

The tool has a "control modus". If selected, the result (in this case the duration of the call ) is written in the current selected row offset by 18 colums.

When rerating +100K rows, and even with screenupdating and calc disabled, it runs very slow.

Is there a possibility to keep results in the memory (array), and only write the result once, once all rerating has been done.

Select Case ControlModus
    Case Is = "YES", "Yes", "yes"
        ActiveCell.Offset(0, 18).Value = CdrSeconds ' uncomment this in case you want to write control figures next to CDR's
    Case Else
End Select

Open in new window


Thank you for your help
/Xtophe
0
Comment
Question by:Xtophe_S
3 Comments
 
LVL 20

Accepted Solution

by:
clarkscott earned 250 total points
ID: 38723465
Well... putting values on spreadsheet is, virtually, maintaining values in an array (since these values are in memory).   With +100k rows... and understanding how Excel maintains row data in memory... you're probably better off using the spreadsheet method versus memory arrays.  

But, depending on how you use this data in your application... you may want to write your data to a sheet like a table (1st row contains headers, all other rows contain data) and access your data on the sheet by opening it like a table and query your data using SQL type statements.

Scott C
0
 
LVL 85

Assisted Solution

by:Rory Archibald
Rory Archibald earned 250 total points
ID: 38723505
Writing 100k cells one by one will be very very slow, so yes you would be far better off writing the results to an array and then writing that to the sheet in one go using a simple:
Range("Y1").Resize(ubound(myarray, 1), ubound(myarray, 2)).Value = myArray

Open in new window


syntax
0
 
LVL 14

Expert Comment

by:Faustulus
ID: 38726144
Have you considered setting Application.ScreenUpdating = False?
The effect would be that no time is spent on updating your screen. Hence, all data are kept in arrays managed by Excel which, arguably, should not be slower than using arrays managed by the user.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question