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.
精彩评论