Gregg Wolin
Member
I created a button ("Reports") that toggles the visibility of a series of sheets (listed within the named range "L_ReportsNames") and assigned the macro below.
My intent is to place a copy of the "Reports" button on other worksheets in the workbook. The Application.Goto line above works fine in the "i_Project" sheet , but ideally, I'd like to get the macro to "go to" the button that triggered the macro regardless of the worksheet on which a copy of the button is placed.
Code:
Public Sub ShowHideReportSheets()
Application.ScreenUpdating = False
For Each Cell In Range("L_ReportNames")
ActiveWorkbook.Worksheets(Cell.Value).Visible = Not ActiveWorkbook.Worksheets(Cell.Value).Visible
Next Cell
Application.Goto (ActiveWorkbook.Sheets("i_Project").Range("a21"))
Application.ScreenUpdating = True
End Sub
My intent is to place a copy of the "Reports" button on other worksheets in the workbook. The Application.Goto line above works fine in the "i_Project" sheet , but ideally, I'd like to get the macro to "go to" the button that triggered the macro regardless of the worksheet on which a copy of the button is placed.