0 out of 5 rated this helpful - Rate this topic

Worksheet.SelectionChange Event

Occurs when the selection changes on a worksheet.

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)

public event DocEvents_SelectionChangeEventHandler SelectionChange

The following code example demonstrates a handler for the SelectionChange event that displays the sheet name and address of the selected range in the status bar.

private void WorksheetSelectionChange()
{
    this.SelectionChange += 
        new Excel.DocEvents_SelectionChangeEventHandler(
        Worksheet1_SelectionChange);
}

void Worksheet1_SelectionChange(Excel.Range Target)
{
    this.Application.StatusBar = this.Name + ":" +
        Target.get_Address(missing, missing,
        Excel.XlReferenceStyle.xlA1, missing, missing);
}

Did you find this helpful?
(1500 characters remaining)