Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Calculations not keeping up with macro

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!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default Calculations not keeping up with macro

Try adding

Application.DoEvents

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

Tim


"xl@lf" wrote in message
...
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!!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Calculations not keeping up with macro

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.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default Calculations not keeping up with macro

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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I write a macro for keeping time? TomK76 Excel Programming 1 December 18th 07 02:32 PM
Keeping a Macro in a new book WBTKbeezy Excel Worksheet Functions 1 June 8th 07 08:36 PM
Keeping a Macro in a New Book WBTKbeezy Excel Programming 1 June 8th 07 07:21 PM
Keeping an Array Filled and running macro from other workbooks? NooK[_5_] Excel Programming 2 June 23rd 04 04:42 PM
Keeping name of worksheet who called macro Dkline[_2_] Excel Programming 3 January 30th 04 06:40 PM


All times are GMT +1. The time now is 04:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"