The selected worksheets is supposed to be a collection and when I tried these two lines
Code: Select all
Dim x
x = ThisWorkbook.Windows(1).SelectedSheets
Code: Select all
Dim x
x = ThisWorkbook.Windows(1).SelectedSheets
Code: Select all
Dim e
For Each e In x.Items
Debug.Print e
Next e
Code: Select all
For Each e in x
Code: Select all
Debug.Print e.Name
Code: Select all
Debug.Print e.UsedRange.Address
Code: Select all
Public Function SheetExists(strSheetName As String, Optional testSheets As Sheets) As Boolean
If testSheets Is Nothing Then Set testSheets = ActiveWorkbook.Sheets
On Error Resume Next
SheetExists = testSheets.Item(strSheetName).Name <> ""
On Error GoTo 0
End Function