在VBA中触发完整计算 [英] Trigger a full calculation in VBA

查看:160
本文介绍了在VBA中触发完整计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出一个包含大量公式的工作簿,我意识到,当其单元格值为最新时,F9ActiveWorkbook.CalculateSheets(1).calculate不会触发重新计算.

Given a workbook that contains lots of formulas, i realise that when its cell values are up-to-date, F9, ActiveWorkbook.Calculate or Sheets(1).calculate does not trigger a re-calculation.

但是,如果另一个单元格通过公式引用的单元格值发生更改,则F9ActiveWorkbook.CalculateSheets(1).calculate将触发对依赖于更改后的单元格的所有公式的重新计算.

However, if a cell value that is referenced by another cell through formula changes, F9, ActiveWorkbook.Calculate or Sheets(1).calculate will trigger a recalculation of all the formulas that depend on the changed cell.

一句话,Excel只是重新计算了必要的内容.

In one word, Excel just recalculates which is necessary.

但是,我想测量工作簿的完整计算的行为(例如时间)(即,从常量值刷新,然后取决于它们的公式,再到更高级别的公式...).

However, I would like to measure the behavior (eg, time) of a FULL calculation of the workbook (ie, refreshing from the constant values, then the formulas depending on them, then a higher level formulas...).

有人知道如何在VBA中触发这样的完整计算吗?

Does anyone know how to trigger such a full calculation in VBA?

推荐答案

您有两个选择-CalculateFullCalculateFullRebuild.后者将重建整个依赖链,因此在这里可能会显得过大.请注意,两者都将适用于所有打开的工作簿,而不仅仅是活动的工作簿.

You have two options - CalculateFull and CalculateFullRebuild. The latter will rebuild the entire dependency chain so may be overkill here. Note that both will apply to all open workbooks, not just the active one.

这篇关于在VBA中触发完整计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆