Window.SelectedSheets property (Excel)

Returns a Sheets collection that represents all the selected sheets in the specified window. Read-only.



expression A variable that represents a Window object.


This example displays a message if Sheet1 is selected in Book1.xls.

For Each sh In Workbooks("BOOK1.XLS").Windows(1).SelectedSheets 
 If sh.Name = "Sheet1" Then 
 MsgBox "Sheet1 is selected" 
 Exit For 
 End If 

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.