+ Reply to Thread
Results 1 to 8 of 8

Drop down list that changes selected sheet

  1. #1
    Registered User
    Join Date
    01-18-2010
    Location
    St. Johns, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Smile Drop down list that changes selected sheet

    Hello,

    I'm trying to create a drop down list that changes the selected sheet. Basically, I want a main sheet that has a single drop down list with four selections, and when something in that list is selected, I want the workbook to switch to a specific sheet in the workbook. Can anyone here help?

    Thanks

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Drop down list that changes selected sheet

    You will need to use VBA to change sheet though you can simply use Data Validation List to create the options...

    might be an idea to outline how the options dictate which sheet is to be selected... ie are the options the sheet names themselves or something else entirely ?

  3. #3
    Registered User
    Join Date
    01-18-2010
    Location
    St. Johns, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Drop down list that changes selected sheet

    The options are the sheet names themselves, does this make it easier?

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Drop down list that changes selected sheet

    Yes though it would not be too complex either way in truth - just needed to know for sake of demo.

    If we assume A1 holds a Data Validation List containing the 4 sheet names ... right click on the Tab name -> View Code -> paste below into resulting window:

    Please Login or Register  to view this content.
    obviously alter A1 per your own requirements (ie to reflect the actual location of your validation cell)

    thereafter in a macro enabled state altering selection in the validation list will navigate to the selected sheet.
    Last edited by DonkeyOte; 01-18-2010 at 01:35 PM. Reason: changed per note below ... ByVal not ByRef (typo!)

  5. #5
    Registered User
    Join Date
    01-18-2010
    Location
    St. Johns, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Drop down list that changes selected sheet

    I have tried entering that code into the window and changing the A1 to the cell I have my list in and when I try to select something from the list, I'm prompted with a VBA compile error that says

    "Procedure declaration does not match description of event or procedure having same name"

    I'm using excel 2003, does this have anything to do with my problem?

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Drop down list that changes selected sheet

    Quote Originally Posted by Mike_StGeorge
    I'm using excel 2003, does this have anything to do with my problem?
    No, not at all, the problem is to do with me being :

    a) a dunce

    b) lazy and coding ad hoc

    the ByRef should read ByVal... I've modified my earlier code.

  7. #7
    Registered User
    Join Date
    06-22-2017
    Location
    England, UK
    MS-Off Ver
    14.34 for Mac
    Posts
    1

    Re: Drop down list that changes selected sheet

    Hey! This has worked a treat for me, i was wondering whether there was a way for it to still work with hidden sheets?

    Many thanks,

    Rory

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Drop down list that changes selected sheet

    Rory, welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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