tags:

views:

121

answers:

3

Hi,

Is there anyway to trigger (from VBA) excel asking it to reevaluate ALL its excel cells ?

thank You

A: 

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

Ardman
+1  A: 

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

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

Neil Aitken
I tried this method. At the Initial call it will revaluate the sheet, but in subsequent calls it does not revaluate all cells. Is there any condition need to be satifies on order to reevaluate cells by Calculate function?
Nimo
Updated answer.
Neil Aitken
+2  A: 

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

almog.ori