Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 1.02 KB

Excel.Worksheet.SelectionChange.md

File metadata and controls

47 lines (31 loc) · 1.02 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Worksheet.SelectionChange event (Excel)
vbaxl10.chm502073
vbaxl10.chm502073
Excel.Worksheet.SelectionChange
183e2ca7-06b2-f689-1f77-182dbfbf1e1d
05/30/2019
medium

Worksheet.SelectionChange event (Excel)

Occurs when the selection changes on a worksheet.

Syntax

expression.SelectionChange (Target)

expression A variable that represents a Worksheet object.

Parameters

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

Example

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

[!includeSupport and feedback]