Solved

VBA chart-drawing excel macro CPU/Memory optimization

Posted on 2004-04-27
5
500 Views
Last Modified: 2010-05-18
Hi,

I'm not sure if this is the right place to ask...But here it is.

I have 200 columns and 40 rows long sheet in Excel and I have coded a Macro to plot charts of every column agains every other (to understand correlation between the data).

Now the problem is that while plotting, with ScreenUpdate=False, my CPU utilization shoots up to 100% ...plotting hundreds of those charts in new sheets (one per column under consideration)! ....and it takes FOREVER..to finish it........

Please let me know if you know of a trick or optimization to reduce my CPU and MEMORY utilization for such a macro!

Thanks (hope I explained it well!)
~essjthakkar
0
Comment
Question by:essjthakkar
5 Comments
 
LVL 6

Expert Comment

by:LunaSkye
ID: 10934647
Hi,
Im not exactly sure if i understand it,  but alot of times, if you have stuff visible it takes longeer just becuase of the refreshes.  Try makking each chart     .visible = false  until you have filled it, then turn it visible.

Also, maybe if you throw a "DoEvents" statement in the loop.  That way, after each iteration, you give the computer a chance to process other events on the system.

-Andrew
0
 

Author Comment

by:essjthakkar
ID: 10954861
Ok, about the Visible=false idea, is this possible ?  (algorithmic steps...)

repeat:
    create chart object
    Set the chart to visible=false,
    Populate the chart :  get chart data, set the title, etc.
    Set the chart to visible=true now, since its ready.
go to "repeat" for another chart

I tried setting Visible=false before actually populating the chart, but apparently, it gave me an Error!  IS IT NOT possible to set a chart to invisible and THEN populate it?

:S
~Siddharth
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 11464194
PAQed, with points refunded (125)

DarthMod
Community Support Moderator
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now