Solved

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

Posted on 2012-12-27
3
190 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

726 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