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