I have a workbook that contains several worksheets. One particular worksheet is a main page with buttons that open up the other worksheets for the user to view specific data. To minimize the open worksheets I have tried to institute a worksheet activate so that when the user selects this main page tab all other worksheets hide. It works well, for most of the sheets. However, for some reason a few sheets will not hide. Ive tried several different codes to get these particular sheets to close to no avail. Ive tried calling each sheet individually to hide the sheet, and Ive tried to hide all sheets together. Codes Ive used are below. Again, both codes work fine but only on some sheets. How can I get the Activate call to work for all sheets? Anyone ever have this issue? The particular sheets Im having a hard time with are in red in 2nd code.
Codes Ive used:
And:![]()
Private Sub Worksheet_Activate() 'Closes all open sheets and goes back to main menu Dim sh As Worksheet For Each sh In ThisWorkbook.Worksheets If Not sh.Name = "Reports" Then sh.Visible = False Next sh End Sub
![]()
Private Sub Worksheet_Activate() Sheets("Pivot32nd_Hr_By Model").Visible = False Sheets("Chart32nd_Hr_By Model").Visible = False Sheets("PivotMontlyWearVsBilledWear").Visible = False Sheets("ChartMonthlyWearvsBilledWear").Visible = False Sheets("PivotCostByBrand").Visible = False Sheets("ChartCostByBrand").Visible = False Sheets("PivotCostByModel").Visible = False Sheets("ChartCostByModel").Visible = False Sheets("Data50%Below").Visible = False Sheets("Pivot50%Below").Visible = False Sheets("Chart50%Below").Visible = False Sheets("DataFleet%Tread").Visible = False Sheets("PivotFleet%Tread").Visible = False Sheets("ChartFleet%Tread").Visible = False Sheets("PivotCustomerWear_Hr").Visible = False Sheets("ChartCustomerWear_Hr").Visible = False
Bookmarks