April 2006
Beginner
1114 pages
98h 16m
English
Application.Selection
Returns the currently selected objects on the active worksheet. Returns Nothing if no objects are selected. Use the Select method to set the selection, and use TypeName to discover the kind of object that is selected. The following code displays information about the current selection:
Sub TestSelection( )
Dim str As String
Select Case TypeName(Selection)
Case "Nothing"
str = "Please select something."
Case "Range"
str = "You selected the range: " & Selection.Address
Case "Picture"
str = "You selected a picture."
Case Else
str = "You selected a " & TypeName(Selection) & "."
End Select
MsgBox str
End SubRead now
Unlock full access