开发者

How to refresh ALL cell through VBA

开发者 https://www.devze.com 2022-12-21 15:54 出处:网络
Is there anyway to trigger (from VBA) excel asking it to 开发者_如何学Pythonreevaluate ALL its excel cells ?

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

精彩评论

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

关注公众号