Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2012-12-27
3
Medium Priority
?
209 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 20

Accepted Solution

by:
clarkscott earned 750 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 750 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

636 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