Applies To
Application Object, Window Object.
Description
Accessor. If you specify the Application object (or omit the object qualifier), this property returns the selected object in the active window. If you specify a Window object, this property returns the selected object in the specified window. Read-only.
Remarks
The object type returned by the Selection property depends on the type of selection (for example, if a text box is selected, this property returns a TextBox object.)
The Selection property returns Nothing if nothing is selected.
See Also
Activate Method, ActiveCell Property, Select Method, Selected Property.
Example
This example clears the selection on Sheet1 (assuming that the selection is a range of cells).
Worksheets("Sheet1").Activate Selection.Clear
This example displays the Visual Basic object type of the selection. Try running this example with cells selected, with a single oval selected, and with several different graphic objects selected.
Worksheets("Sheet1").Activate MsgBox "The selection object type is " & TypeName(Selection)