• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Code to hide sheets

Pasadu

Member
Dear Sir, I have this work where I have 8 sheets, named A B C D E F G H. Is it possible that the work can only hide sheets D to F and display only ABC?
Can I have 1 code that will hide sheets D E F G H, and just 1 code to unhide them all? Why? Because I don't want to hide and unhide them one by one. I wish to have a code to hide and unhide many sheets, once. Thank you.
 
Code:
Sub VeryHiddenSheet()
Dim e
   For Each e In Array("D", "E", "F", "G", "H")
        ThisWorkbook.Sheets(e).Visible = xlVeryHidden
   Next e
End Sub
 
Hi, an unique VBA procedure as a toggle :​
Code:
Sub HideUnhide()
    For Each V In [{"D","E","F","G","H"}]:  Worksheets(V).Visible = Not Worksheets("H").Visible:  Next
End Sub
Do you like it ? So thanks to click on bottom right Like !
 
Back
Top