I would be grateful if someone could tell me why this works:
Sub SheetArrayTest()
Dim wShtArray() As Variant
Dim Sht As Variant
wShtArray = Array(Sheet01, Sheet02, Sheet03)
For Each Sht In wShtArray
Sht.Visible = True
Next
End Sub
but this doesn't (throws "Object doesn't support this property or method"):
Sub SheetRangeTestA()
Dim Sht As Variant
For Each Sht In Range("MainSheets")
Sht.Visible = True
Next
End Sub
I am guessing that the array is passing the sheet codenames as objects and that's what is needed. If so, what do I need to do to get the same sheet codenames held in the named range "MainSheets" to work in the same way? I have tried reading "MainSheets" into an array but that doesn't work.
Thanks.
Bookmarks