Worksheet.Calculate Event (2007 System)

Occurs after the worksheet is recalculated.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
Public Event Calculate As DocEvents_CalculateEventHandler
'Usage
Dim instance As Worksheet 
Dim handler As DocEvents_CalculateEventHandler 

AddHandler instance.Calculate, handler
public event DocEvents_CalculateEventHandler Calculate
public:
 event DocEvents_CalculateEventHandler^ Calculate {
    void add (DocEvents_CalculateEventHandler^ value);
    void remove (DocEvents_CalculateEventHandler^ value);
}
JScript does not support events.

Examples

The following code example demonstrates a handler for the Calculate event that displays the name of the worksheet when it is calculated.

This example is for a document-level customization.

Sub Worksheet1_Calculate() Handles Me.Calculate
    MsgBox(Me.Name & " is being calculated")
End Sub
private void WorksheetCalculate()
{
    this.Calculate += new 
        Excel.DocEvents_CalculateEventHandler(
        Worksheet1_Calculate);
}

void Worksheet1_Calculate()
{
    MessageBox.Show(this.Name + " is being calculated");
}

.NET Framework Security

See Also

Reference

Worksheet Class

Worksheet Members

Microsoft.Office.Tools.Excel Namespace