开发者

How to refresh ALL cell through VBA

Is there anyway to trigger (from VBA) excel asking it to 开发者_如何学Pythonreevaluate ALL its excel cells ?

thank You


The calculate method can recalculate individual worksheets or the entire workbook.

Edit re comment: Try setting Application.Volatile (true) before calling calculate.


Application.Volatile is a vba interpreter trick that only works when the call is placed directly after the method definition, after that Application.Calculate should reevaluate the function as well

Public Function FooMethod()
Application.Volatile true

as the help states ...

Marks a user-defined function as volatile. A volatile function must be recalculated whenever calculation occurs in any cells on the worksheet. A nonvolatile function is recalculated only when the input variables change. This method has no effect if it's not inside a user-defined function used to calculate a worksheet cell


If you use the SendKeys method, you can use Shift+F9 to do this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜