Create popup menu to unhide worksheet

trypsin25

New Member
Joined
Jan 7, 2016
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hi! I am looking for a code that will create a popup menu that appears when a user opens the workbook. The menu would have 4 choices and each choice would unhide a different set of tabs. Below are the menu names and tab combinations. I'm not even sure where to start. TIA!!!


Menu Option Would unhide tabs
Direct Sales LeadershipSoftwareOverview & DirectSales & AccountList
ETC DRB Summary & ETC Pricing & PI Software
Leadership&Software LeadershipSoftwareOverview & LeadershipSoftwareDealBuild & AccountList
ETC PLUS Leadership&Software DRB Summary & ETC Pricing & PI Software & LeadershipSoftwareOverview & LeadershipSoftwareDealBuild & AccountList
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Only you know where the menu options end and the tab names begin. You need to tell us and, for me at least, does "unhide a set of tabs" mean just one tab for each option or more than one tab for each option?
 
Upvote 0
So sorry!! Below are the options and tabs in a better format. Thanks!!

Menu Option 1 = Direct Sales
Unhides tabs =
LeadershipSoftwareOverview & DirectSales & AccountList

Menu Option 2 = ETC
Unhides tabs = DRB Summary & ETC Pricing & PI Software

Menu Option 3 =Leadership&Software
Unhides tabs =LeadershipSoftwareOverview & LeadershipSoftwareDealBuild & AccountList

Menu Option 4 = ETC PLUS Leadership&Software
Unhides tabs = DRB Summary & ETC Pricing & PI Software & LeadershipSoftwareOverview & LeadershipSoftwareDealBuild & AccountList

 
Upvote 0
So sorry!! Below are the options and tabs in a better format. Thanks!!

Menu Option 1 = Direct Sales
Unhides tabs =
LeadershipSoftwareOverview & DirectSales & AccountList

Menu Option 2 = ETC
Unhides tabs = DRB Summary & ETC Pricing & PI Software

Menu Option 3 =Leadership&Software
Unhides tabs =LeadershipSoftwareOverview & LeadershipSoftwareDealBuild & AccountList

Menu Option 4 = ETC PLUS Leadership&Software
Unhides tabs = DRB Summary & ETC Pricing & PI Software & LeadershipSoftwareOverview & LeadershipSoftwareDealBuild & AccountList
 
Upvote 0
So sorry!! Below are the options and tabs in a better format. Thanks!!

Menu Option 1 = Direct Sales
Unhides tabs =
LeadershipSoftwareOverview & DirectSales & AccountList

Menu Option 2 = ETC
Unhides tabs = DRB Summary & ETC Pricing & PI Software

Menu Option 3 =Leadership&Software
Unhides tabs =LeadershipSoftwareOverview & LeadershipSoftwareDealBuild & AccountList

Menu Option 4 = ETC PLUS Leadership&Software
Unhides tabs = DRB Summary & ETC Pricing & PI Software & LeadershipSoftwareOverview & LeadershipSoftwareDealBuild & AccountList
This is untested so may need some tweaking. The code below goes into a Thisworkbook module. Follow the instructions below.

To install ThisWorkbook code:
1. With your workbook active press Alt and F11 keys. This will open the VBE window.
2. In the project tree on the left of the VBE window, find your project and double-click the 'Thisworkbook' icon.
3. Copy the code below from your browser window and paste it into the white space in the VBE window.
4. Close the VBE window and Save the workbook. If you are using Excel 2007 or a later version do a SaveAs and save it as a macro-enabled workbook (.xlsm file extension).
5. Make sure you have enabled macros whenever you open the file or the code will not run.
Code:
Private Sub Workbook_Open()
Dim Msg As String, OptNum As Variant, Sht As Worksheet
Msg = "Enter the option number from the Options below" & vbCrLf & vbCrLf
Msg = Msg & "1. Direct Sales"
Msg = Msg & vbCrLf & vbCrLf & "2. ETC"
Msg = Msg & vbCrLf & vbCrLf & "3. Leadership&Software"
Msg = Msg & vbCrLf & vbCrLf & "4. ETC PLUS"
OptNum = Application.InputBox(Msg, Title:="SELECT AN OPTION NUMBER", Type:=1)
If OptNum = False Then Exit Sub
Application.ScreenUpdating = False
Select Case OptNum
    Case 1
        For Each Sht In Sheets(Array("LeadershipSoftwareOverview", "DirectSales", "AccountList"))
            Sht.Visible = True
        Next Sht
    Case 2
        For Each Sht In Sheets(Array("DRB Summary", "ETC Pricing", "PI Software"))
            Sht.Visible = True
        Next Sht
    Case 3
        For Each Sht In Sheets(Array("LeadershipSoftwareOverview", "LeadershipSoftwareDealBuild", "AccountList"))
            Sht.Visible = True
        Next Sht
    Case 4
        For Each Sht In Sheets(Array("DRB Summary", "ETC Pricing", "PI Software", "LeadershipSoftwareOverview", "LeadershipSoftwareDealBuild", "AccountList"))
            Sht.Visible = True
        Next Sht
End Select
Application.ScreenUpdating = True
End Sub
The code will run automatically whenever the workbook is first opened.
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top