Wait for calc and print in macro

Giganews Newsgroups
Subject: Wait for calc and print in macro
Posted by:  brett.kapl…@gmail.com
Date: Tue, 29 Jul 2008

Hi,

I am trying to create a macro that will load an ID into one cell, and
many other cells will calculate based off of that ID.  Some of these
calculations are from external sources, so it could take between 10-30
seconds for everything to update.  Once all the cells on the sheet are
updated, I want to print the sheet, then load in the next ID, and
repeat the process.

Right now, I have no issue with the code for loading the ID or
printing the sheet.  The problem is that the print happens before the
cells are done calculating.

To try to remedy this, I put in an Application.Wait command for 10
seconds, and then added a Do While Loop that if the CalculationState
<> xlDone, then to wait another 10 seconds.  However, it still prints
before anything is updated.

Any thoughts on how to fix this?

Thanks!
Brett

Replies