Share via


SelectionChange Event

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.

Remarks

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

Applies to | ChartSpace Object | PivotTable Object | Spreadsheet Object

See Also | Select Method | Selection Property | SelectionChanging Event | SelectionType Property