Ensuring that all calculations are done before proceeding - VBA

Created by Damien Zwillinger, Modified on Tue, 22 Oct at 11:09 AM by Harry Lewis

Applies to:

  • Velixo Classic



Important: Visual Basic for Applications macros are not supported by Excel Online.


Overview

When creating your own VBA code (aka Excel macros), there will be times when you make a change to a cell within your workbook.

 

This will cause Excel to recalculate any other cells which depend upon the changed cell.  Excel's recalculation occurs while your macro code is going about its next steps.  This is referred to as "asynchronous calculation".

 

 

Symptoms

Depending upon the situation, this can cause your VBA code to see cell contents that are not yet complete.

 

e.g.,

 

 ... until the Excel calculation process completes, and the final cell contents are displayed:

 

 

 

Thus, there are times when you will want to be able to ensure that all calculations are fully completed before you proceed in the next part of your macro.

 

  

Feature

The Velixo.Reports.Vba object supports this ability.

 

Once you have created your Velixo Object ( as described here: Introduction to Velixo's VBA functions), you can set the AsyncCalculations property to FALSE.

 


Setting AsyncCalculations to FALSE ensures that whatever change you make to a cell (e.g., changing a date, account, subaccount) will be fully completed by the time you move to the next line of code.

 

e.g.,

 

 

 

 

Download Example Excel File

 

The example is configured to use the Velixo Demo of Acumatica.  If desired, you can use the Velixo Connection Manager to update the Demo connection to retrieve data from your ERP

 

? If you have trouble downloading the file,
simply right-click the link and select Save link as

 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article