Hi All -
Note I did not say "Group" in the title of this post so no-one misconstrues this question with tab function of group and ungroup.
After wrestling the following macro to the ground, I was wondering if I am asking too much to write a second worksheet.activation macro that would do the same thing - Hide or Unhide a different bunch of tabs - but leave the first bunch of tabs either hidden or unhidden as they are when the second Hide or Unhide activation is executed.
Hope that is clear although I'm pretty sure it wasn't.
Any help would be much appreciated.
Amy
Private Sub Worksheet_Activate()
Dim Sheet As Worksheet
Application.ScreenUpdating = False
If Sheet11.Name = "Fcst_Reports Open" Then
For Each Sheet In ThisWorkbook.Sheets
Sheet.Visible = xlSheetVisible
Next Sheet
Sheet11.Name = "Fcst_Reports Close"
Sheets("Fcst_Epax").Select
Else
For Each Sheet In ThisWorkbook.Sheets
'Hide All Sheets Except For These:
If (Sheet.Name <> Sheet1.Name And Sheet.Name <> Sheet2.Name _
And Sheet.Name <> Sheet10.Name And Sheet.Name <> Sheet5.Name _
And Sheet.Name <> Sheet6.Name And Sheet.Name <> Sheet7.Name _
And Sheet.Name <> Sheet23.Name And Sheet.Name <> Sheet9.Name) Then
Sheet.Visible = xlSheetHidden
End If
Next Sheet
Sheet11.Name = "Fcst_Reports Open"
Sheets("AA_Database").Select
End If
Application.ScreenUpdating = True
End Sub
Note I did not say "Group" in the title of this post so no-one misconstrues this question with tab function of group and ungroup.
After wrestling the following macro to the ground, I was wondering if I am asking too much to write a second worksheet.activation macro that would do the same thing - Hide or Unhide a different bunch of tabs - but leave the first bunch of tabs either hidden or unhidden as they are when the second Hide or Unhide activation is executed.
Hope that is clear although I'm pretty sure it wasn't.
Any help would be much appreciated.
Amy
Private Sub Worksheet_Activate()
Dim Sheet As Worksheet
Application.ScreenUpdating = False
If Sheet11.Name = "Fcst_Reports Open" Then
For Each Sheet In ThisWorkbook.Sheets
Sheet.Visible = xlSheetVisible
Next Sheet
Sheet11.Name = "Fcst_Reports Close"
Sheets("Fcst_Epax").Select
Else
For Each Sheet In ThisWorkbook.Sheets
'Hide All Sheets Except For These:
If (Sheet.Name <> Sheet1.Name And Sheet.Name <> Sheet2.Name _
And Sheet.Name <> Sheet10.Name And Sheet.Name <> Sheet5.Name _
And Sheet.Name <> Sheet6.Name And Sheet.Name <> Sheet7.Name _
And Sheet.Name <> Sheet23.Name And Sheet.Name <> Sheet9.Name) Then
Sheet.Visible = xlSheetHidden
End If
Next Sheet
Sheet11.Name = "Fcst_Reports Open"
Sheets("AA_Database").Select
End If
Application.ScreenUpdating = True
End Sub