Worksheet.SelectionChange event (Excel)

Occurs when the selection changes on a worksheet.


expression.SelectionChange (Target)

expression A variable that represents a Worksheet object.


Name Required/Optional Data type Description
Target Required Range The new selected range.


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

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

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.