WorksheetBase.Change Event

 

Occurs when something changes in the WorksheetBase cells.

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

public event DocEvents_ChangeEventHandler Change

This event does not occur when cells change during a recalculation.

The following code example demonstrates a handler for the Change event that displays the name of the worksheet and the range of cells that were changed.

This example is for a document-level customization.

private void WorksheetChange()
{
    this.Change += 
        new Excel.DocEvents_ChangeEventHandler(
        Worksheet1_Change);
}

void Worksheet1_Change(Excel.Range Target)
{
    string changedRange = Target.get_Address(Excel.XlReferenceStyle.xlA1);

    MessageBox.Show("The value of " + this.Name + ":" +
        changedRange + " has been changed.");
}
Return to top
Show: