There is a way to select multiple Excel sheets and then do some action on them like Print. However given a workbook, how do i get to know which sheets are selected. There is a vba property Application->ActiveSheet which gives us current active sheet, but i couldn't find any way to get multiple sheets for this.
Is this what you want?
Option Explicit
Sub Sample()
Dim ws As Worksheet
Dim SelectedSheets() As String
Dim n As Long, i As Long
n = 0
For Each ws In ActiveWindow.SelectedSheets
ReDim Preserve SelectedSheets(n)
SelectedSheets(n) = ws.Name
n = n + 1
Next
For i = LBound(SelectedSheets) To UBound(SelectedSheets)
'~~> This will give you the list of selected sheets
Debug.Print SelectedSheets(i)
Next i
'~~> The collection can also be used as below
'Sheets(SelectedSheets).Copy
'Sheets(SelectedSheets).Select ' e.g., to re-select them later
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With