Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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)
Syntax
'Declaration
Public Event Change As DocEvents_ChangeEventHandler
public event DocEvents_ChangeEventHandler Change
Remarks
This event does not occur when cells change during a recalculation.
Examples
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.
Sub Worksheet1_Change(ByVal Target As Excel.Range) _
Handles Me.Change
Dim changedRange As String = Target.Address( _
ReferenceStyle:=Excel.XlReferenceStyle.xlA1)
MsgBox("The value of " & Me.Name & ":" & changedRange & " has been changed.")
End Sub
private void WorksheetChange()
{
this.Change +=
new Excel.DocEvents_ChangeEventHandler(
Worksheet1_Change);
}
void Worksheet1_Change(Excel.Range Target)
{
string changedRange = Target.get_Address(missing, missing,
Excel.XlReferenceStyle.xlA1, missing, missing);
MessageBox.Show("The value of " + this.Name + ":" +
changedRange + " has been changed.");
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.