PC Review


Reply
Thread Tools Rate Thread

Calculations not keeping up with macro

 
 
xl@lf
Guest
Posts: n/a
 
      9th Mar 2010
Hello,

I have a spreadsheet with 51 tabs. Tab_1 is a summary of data
contained on the remaining 50 sheets (such as averages and sums). A
macro iterates through values of 1 - 100. During each iteration a
variable with dependents changes on each of the 50 sheets and
resulting data for each iteration is output on the summary tab (output
such as the averages and sums for each iteration).

The macro works great when I step through it, the problems occur when
I run it at full speed. The output data at each iteration does not
keep up with the macro, thus the outputs are inaccurate. It's like
the macro runs faster than all the calculations are performed and
output.

Any suggestions to help alleviate this challenge would be greatly
appreciated.

Thanks!!
 
Reply With Quote
 
 
 
 
Tim Williams
Guest
Posts: n/a
 
      9th Mar 2010
Try adding

Application.DoEvents

at the end of each loop (or wherever you're triggering a recalculation).

Tim


"xl@lf" <(E-Mail Removed)> wrote in message
news:1b799b09-f922-4dc9-b5dd-(E-Mail Removed)...
> Hello,
>
> I have a spreadsheet with 51 tabs. Tab_1 is a summary of data
> contained on the remaining 50 sheets (such as averages and sums). A
> macro iterates through values of 1 - 100. During each iteration a
> variable with dependents changes on each of the 50 sheets and
> resulting data for each iteration is output on the summary tab (output
> such as the averages and sums for each iteration).
>
> The macro works great when I step through it, the problems occur when
> I run it at full speed. The output data at each iteration does not
> keep up with the macro, thus the outputs are inaccurate. It's like
> the macro runs faster than all the calculations are performed and
> output.
>
> Any suggestions to help alleviate this challenge would be greatly
> appreciated.
>
> Thanks!!



 
Reply With Quote
 
xl@lf
Guest
Posts: n/a
 
      9th Mar 2010
I tried the Doevents and it appeared to put the spreadsheet in manual
calculation mode. The macro processed at a blazing speed and all the
output data was identical. When the macro was finished I pressed F9
and it updated all the values. Since I'm constantly updating values
manual calculations won't work for me in this macro. Thanks Tim.
 
Reply With Quote
 
Tim Williams
Guest
Posts: n/a
 
      10th Mar 2010
I've never seen DoEvents put the application in manual calculation mode.

In any event, you might be better off putting Excel in manual calculation
mode at the start of the macro, and calling Application.Calculate just
before you want to pick up any results. Don't forget to turn it back to
automatic at the end of the routine.

Tim



"xl@lf" <(E-Mail Removed)> wrote in message
news:970dceeb-8a0d-4346-8d2a-(E-Mail Removed)...
>I tried the Doevents and it appeared to put the spreadsheet in manual
> calculation mode. The macro processed at a blazing speed and all the
> output data was identical. When the macro was finished I pressed F9
> and it updated all the values. Since I'm constantly updating values
> manual calculations won't work for me in this macro. Thanks Tim.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hide macro calculations Adam Microsoft Excel Misc 4 11th Apr 2008 06:00 PM
Keeping a Macro in a new book =?Utf-8?B?V0JUS2JlZXp5?= Microsoft Excel Worksheet Functions 1 8th Jun 2007 08:36 PM
Keeping a Macro in a New Book =?Utf-8?B?V0JUS2JlZXp5?= Microsoft Excel Programming 1 8th Jun 2007 07:21 PM
calculations on vlookup during a macro Kenlyn Microsoft Excel Discussion 1 26th Feb 2005 01:10 PM
Keeping name of worksheet who called macro Dkline Microsoft Excel Programming 3 30th Jan 2004 06:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:50 PM.