Spreadsheet.Recalculate
This function recalculates the specified variable formula (optionally within a specified case range).
| Syntax | Parameters | Return Value |
|---|---|---|
Sub Spreadsheet.Recalculate( _
Optional Variable As Variant, _
Optional FirstCase As Variant, _
Optional LastCase As Variant)
|
Which variable to recalculate. This parameter by default will recalculate all of the spreadsheet's variables. Type: Variant
The beginning of the range of cases to recalculate. This parameter by default will recalculate all of the spreadsheet's cases. Type: Variant
The end of the range of cases to recalculate. This parameter by default will recalculate all of the spreadsheet's cases. Type: Variant |
This function does not return a value. |
SVB Example
Adding a formula:
Option Base 1
Option Explicit
Sub Main
'Set variable 1 to be variable 2's value (formatted into currency).
'Note that we call ConvertLocale to ensure that the formula will be
'formatted properly under the current locale.
ActiveSpreadsheet.VariableLongName(1) = Application.ConvertLocale("=ToStringEx(v2,""$0.00"")", scToInternational)
ActiveSpreadsheet.Recalculate(1,,)
End Sub