+ Reply to Thread
Results 1 to 13 of 13

Hide and unhide tabs using drop-down menu with in excel

  1. #1
    Registered User
    Join Date
    11-28-2019
    Location
    Munich
    MS-Off Ver
    MS Office 2010
    Posts
    6

    Question Hide and unhide tabs using drop-down menu with in excel

    Hi all,

    I would like to hide a single tab using a drop-down menu with 4 items.

    I have four tabs (Results 1, Results 2, Results 3, Results 4) and a drop-down menu with 4 items (Scenario 1, Scenario 2, Scenario 3, Scenario 4).

    When "Scenario 1" is selected, only the tab "Results 1" should be visible and the other tabs (Results 2, Results 3, Results 4) should be hidden.
    When "Scenario 2" is selected, only the tab "Results 2" should be visible and the other tabs (Results 1, Results 3, Results 4) should be hidden.
    When "Scenario 3" is selected, only the tab "Results 3" should be visible and the other tabs (Results 1, Results 2, Results 4) should be hidden.
    When "Scenario 4" is selected, only the tab "Results 4" should be visible and the other tabs (Results 1, Results 2, Results 3) should be hidden.

    Does anybody know what the appropriate code for that is?

    Thanks a lot in advance for your help, highly appreciated.

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Hide and unhide tabs using drop-down menu with in excel

    Where is drop down menu located? On other tab? Or the same drop-down is located on each of Result tabs?
    You've said I've got 4 tabs so I suppose dropdown is on each of them, so (in case if drodown menu is located in A1):

    Please Login or Register  to view this content.
    code have to be put inside EACH OF 4 RESULT TABS.

    Check attached file.
    Attached Files Attached Files
    Last edited by KOKOSEK; 11-28-2019 at 12:44 PM.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  3. #3
    Registered User
    Join Date
    11-28-2019
    Location
    Munich
    MS-Off Ver
    MS Office 2010
    Posts
    6

    Re: Hide and unhide tabs using drop-down menu with in excel

    The drop-down menu is on another tab ("Inputs") located.

  4. #4
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Hide and unhide tabs using drop-down menu with in excel

    So ONLY into Inputs vba code:

    Please Login or Register  to view this content.
    check attached file.
    Attached Files Attached Files

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Hide and unhide tabs using drop-down menu with in excel

    Hello Hanz-Germany,

    The drop-down menu is on another tab ("Inputs") located
    It is difficult to guess what your Workbook set-up looks like.

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  6. #6
    Registered User
    Join Date
    11-28-2019
    Location
    Munich
    MS-Off Ver
    MS Office 2010
    Posts
    6

    Question Re: Hide and unhide tabs using drop-down menu with in excel

    Thanks a lot, KOKOSEK. The code is exactly what I looked for.
    Apologies, I forgot that I have more tabs which should be hidden. Do you know how the code should look like for this case?

    When "Scenario 1" is selected, only the tabs "Results 1" and "ICER 1" should be visible and the other tabs (Results 2, Results 3, Results 4, ICER 2, ICER 3, ICER 4) should be hidden.
    When "Scenario 2" is selected, only the tabs "Results 2" and "ICER 2" should be visible and the other tabs (Results 1, Results 3, Results 4, ICER 1, ICER 3, ICER 4) should be hidden.
    When "Scenario 3" is selected, only the tabs "Results 3" and "ICER 3" should be visible and the other tabs (Results 1, Results 2, Results 4, ICER 1, ICER 2, ICER 4) should be hidden.
    When "Scenario 4" is selected, only the tabs "Results 4" and "ICER 4" should be visible and the other tabs (Results 1, Results 2, Results 3, ICER 1, ICER 2, ICER 3) should be hidden.

    For your convenience, I have attached the worksheet.

    Thanks a lot again for your help. Highly appreciated.
    Attached Files Attached Files
    Last edited by Hanz-Germany; 11-29-2019 at 05:43 AM.

  7. #7
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Hide and unhide tabs using drop-down menu with in excel

    Oh Hanz...

    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-28-2019
    Location
    Munich
    MS-Off Ver
    MS Office 2010
    Posts
    6

    Question Re: Hide and unhide tabs using drop-down menu with in excel

    Thanks a lot KOKOSEK.

    Firstly, I hoped that I can adjust the rest on my own, but I just don't know how to adapt this code.

    I attached the original worksheet where some tabs should be visible all the time, and some of the "results" and "icer" tabs only depending on the selection in the drop-down list on the "efficacy inputs" sheet. Is there a possible code for this?

    All my apologies for the inconveniences, I am very sorry!!!! I thought I begin simply and do the rest on my own, but my excel vba knowledge is far too basic for this adaptation.

    Would you mind helping again with the code? I would be most grateful.

    Thanks a lot.........
    Attached Files Attached Files
    Last edited by Hanz-Germany; 11-29-2019 at 08:57 AM.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Hide and unhide tabs using drop-down menu with in excel

    Try
    You had a typo "Appenix J",should be "Appendix J

    Please Login or Register  to view this content.

  10. #10
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Hide and unhide tabs using drop-down menu with in excel

    No problem. As I did not know on which sheet you want to put your dropdown menu, I've put it on cover (in attached file).
    It shows all existed tabs but visibility of Results / ICER depends on choosen scenario number.

    In attached file code in cover sheet is:

    Please Login or Register  to view this content.

    Cross-post here: https://www.mrexcel.com/board/thread...excel.1116525/
    Please read https://www.excelforum.com/forum-rul...rum-rules.html (point 3).
    Attached Files Attached Files
    Last edited by KOKOSEK; 11-29-2019 at 09:42 AM.

  11. #11
    Registered User
    Join Date
    11-28-2019
    Location
    Munich
    MS-Off Ver
    MS Office 2010
    Posts
    6

    Re: Hide and unhide tabs using drop-down menu with in excel

    Thanks a lot, jindon.
    The code works almost perfectly. But the ICER tabs are all hidden now. When I select the scenario in the drop-down list, the according "results" tab is visible, but not the ICER tab. All ICER tabs are currently hidden. When I select scenario 1, the "results 1" and "ICER 1" tab should be visible, and the same for scenario 2,3,4.
    Do you know how to change the code accordingly?
    Thanks a lot again for your help.

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Hide and unhide tabs using drop-down menu with in excel

    OOps, of course, I missed a space after "ICER "

    , "ICER" & myVal should be , "ICER " & myVal

  13. #13
    Registered User
    Join Date
    11-28-2019
    Location
    Munich
    MS-Off Ver
    MS Office 2010
    Posts
    6

    Re: Hide and unhide tabs using drop-down menu with in excel

    Thanks a lot for your help, KOKOSEK and jindon. Just great. THANKS!!!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Hide/unhide Sheet Tabs in Excel using VBA
    By Wieslaw123 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-22-2017, 05:32 PM
  2. Unhide / Hide worksheets based on drop down menu value
    By Binney in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 09-15-2016, 09:03 AM
  3. Hide/unhide sheets based on drop-down menu
    By arindamsenaxa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-16-2016, 10:01 AM
  4. VBA Hide/Unhide individual sheets based on selection in drop down menu
    By igullage in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-05-2015, 08:01 PM
  5. [SOLVED] VBA macro to hide/unhide particular worksheets on selection from drop-down menu
    By lealea1982 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-08-2014, 09:51 AM
  6. Replies: 10
    Last Post: 09-17-2013, 10:36 AM
  7. Using checkboxes on summary sheet to name tabs and hide/unhide tabs
    By eew2201 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-11-2012, 06:13 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1