• 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.

Unhide two worksheets in range of multiple sheets

Thomas Kuriakose

Active Member
Respected Sirs,

We have multiple sheets in a workbook.

We need to have two worksheets visible at any given time, they are KPI Index and Instructions.

The below code is working for the active sheet KPI Index. How can the worksheet Instructions be added in this to have the two worksheets visible.
Code:
Dim ws As Worksheet
Dim strName As String



    Application.ScreenUpdating = False



    strName = ActiveSheet.Name

    For Each ws In ThisWorkbook.Worksheets

        If ws.Name <> strName Then

            ws.Visible = (WorksheetFunction.CountIf(rngGiven, ws.Name) > 0)

        End If

    Next ws

    Application.ScreenUpdating = True

End Sub

Thank you very much.

with regards,
thomas
 
Last edited by a moderator:
Change this line
Code:
If ws.Name <> strName Then
to
Code:
If ws.Name <> "KPI Index" And ws.Name <>"Instructions" Then
 
Back
Top