Monday, September 22, 2014

How to Hide or Unhide the Specific Sheets with Excel VBA Macro

Excel VBA Macro to Hide or Unhide the Specific Sheets
Let us suppose we have some sheets like...MyReports,My_Links,SLA_Report,Calls_Info in our Workbook.
If you want to Hide or UnHide when Click a Button , you have to assign the Macro to a Button.

Sub Hide_UnHide_TABS()

On Error Resume Next
Application.ScreenUpdating = False

'UnHide if Hideen

    If Sheets("MyReports").Visible = False Or Sheets("My_Links").Visible = False Or _
            Sheets("SLA_Report").Visible = False Or Sheets("Calls_Info").Visible = False Then
            Sheets("MyReports").Visible = True: Sheets("My_Links").Visible = True
            Sheets("SLA_Report").Visible = True: Sheets("Calls_Info").Visible = True
  
 'Hide if  UnHide
    ElseIf Sheets("MyReports").Visible = True Or Sheets("My_Links").Visible = True Or _
            Sheets("SLA_Report").Visible = True Or Sheets("Calls_Info").Visible = True Then
            Sheets(Array("MyReports", "My_Links", "SLA_Report", "Calls_Info")).Select
    ActiveWindow.SelectedSheets.Visible = False
                
    End If

Application.ScreenUpdating = True

End Sub

Thanks,
TAMATAM

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.

Featured Post from this Blog

How to compare Current Snapshot Data with Previous Snapshot in Power BI

How to Dynamically compare two Snapshots Data in Power BI Scenario: Suppose, we have a sample Sales data, which is stored with Monthly Snaps...

Popular Posts from this Blog