This documentation is archived and is not being maintained.

SelectionChange Event

Office 2003

Occurs whenever the user makes a new selection. The user cannot cancel this event.

Private Sub Object_SelectionChange( )

Object    The name of the ChartSpace , PivotTable , or Spreadsheet object that this event applies to.


For information about using events with VBScript, see Declaring and Using Event Procedures in VBScript .

You can use the Selection property to determine the object type of the current selection, as shown in the following example.

Private Sub PivotTable_SelectionChange()
    If TypeName(PivotTable.Selection) = "PivotTotal" Then
        'Handle selection of a total here
    End If
End Sub