Worksheets.Count - 1 Or visibleWs lastV Then VisibleWs = IIf(visibleWs wsCount, wsCount + 1, visibleWs) 'if visibleWs is 0 last ws is visible, or use any other valid sheet index Static vSet As Boolean, hSet As Boolean, wsCount As Long, lastV As Long, i As Long Public Sub SetWsVisibility(Optional ByVal vis As Boolean = False, _ View HideAll - Time: 0.023 sec (consecutive runs - no loop) View ShowAll - Time: 0.023 sec (consecutive runs - no loop) Loop ShowAll - Time: 0.648 sec (initial setup - unhides all using a loop) Loop HideAll - Time: 0.039 sec (initial setup - sets array, except one Ws in one operation) However, there is a much faster method available for this, using Custom Views (in View Tab) As mentioned, you can only Hide multiple sheets without a loop, like in this statement: Worksheets(Array(1,2,3,4,5,6,7,8,9,10,11.,200)).Visible = Trueīut Unhiding multiple sheets requires the loop
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |