Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Glen Mettler" wrote in message
... I have a workbook that contains 25 worksheets. Suppose I select sheets 12, 15, and 21 Is there a way - programmatically - to cycle thru the sheets collection and identify which ones have been selected? I can count the number of sheets selected with: SelectedSheets = ActiveWindow.SelectedSheets.Count but I can't seem to find where I can read which ones are selected. Hi Glen, I'm not totally sure I understand what you're looking for, but ActiveWindow.SelectedSheets returns a collection of the selected Sheet objects. You can enumerate this collection like so: Sub PrintSelectedSheetNames() Dim objSheet As Object For Each objSheet In ActiveWindow.SelectedSheets ''' Print sheet name to Immediate window. Debug.Print objSheet.Name Next objSheet End Sub -- Rob Bovey, Excel MVP Application Professionals http://www.appspro.com/ * Take your Excel development skills to the next level. * Professional Excel Development http://www.appspro.com/Books/Books.htm |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to run on selected sheets | Excel Discussion (Misc queries) | |||
Printing selected sheets. | Excel Worksheet Functions | |||
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? | Excel Worksheet Functions | |||
Multiple sheets selected | Excel Discussion (Misc queries) | |||
printing selected sheets | Excel Programming |