SelectionChange Event
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

Worksheet.SelectionChange Event

Office 2007
Occurs when the selection changes on a worksheet.

Syntax

expression.SelectionChange(Target)

expression   A variable that represents a Worksheet object.

Parameters

NameRequired/OptionalData TypeDescription
TargetRequiredRangeThe new selected range.

Example

This example scrolls through the workbook window until the selection is in the upper-left corner of the window.

Visual Basic for Applications
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    With ActiveWindow
        .ScrollRow = Target.Row
        .ScrollColumn = Target.Column
    End With
End Sub



Show:
© 2016 Microsoft