+ Reply to Thread
Results 1 to 6 of 6

Dropdown With Current sheets in document

  1. #1
    Registered User
    Join Date
    02-06-2018
    Location
    TX
    MS-Off Ver
    2013
    Posts
    38

    Dropdown With Current sheets in document

    Hi,

    I'm Trying to create a dropdown menu in excel that has the current sheets on the bottom of the document, done in a way that if sheets are added or removed they will auto populate in the dropdown. I've seen it done with PowerQuery briefly but cannot find how to accomplish this task. I've looked online and all i get is VBA scripts. Any assistance would be much appreciated.

    Than You in Advance

    -jlara0687

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Dropdown With Current sheets in document

    Is there a particular reason you don't want a VB solution?
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    02-06-2018
    Location
    TX
    MS-Off Ver
    2013
    Posts
    38
    Thank you for your reply. Not really, the only reason is I had seen it accomplished with PowerQuery and I wanted to know how it was done. A VBA solution is definitively welcome. The VBAs I found online were not working correctly, plus I am not well versed in them so I wouldn't know where to begin editing them.

    Thank you

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Dropdown With Current sheets in document

    I think this will work for you since it is a "fill in the blanks" kind of thing. I set it up so that you can create and maintain the drop down list on as many sheets in as many cells as you would like. All you have to do is pass the name of the sheet and the address of the cell to the macro CreateList. In the example below, the macro, MakeDropDown, shows how to do this. It puts a validation drop-down on the Control Panel Sheet in cell C1 and on sheet New Sheet in cell A1. Modify this macro to reflect the sheets and cells you want.

    Please Login or Register  to view this content.
    The following code can be added to the ThisWorkbook module
    Please Login or Register  to view this content.
    When you add a new sheet, it will add it to the list. However, I cannot find a good solution to detect when you rename or delete a sheet. There is an "event" for BeforeSheetDelete, but it runs all the code before deleting the sheet, so it does no good.

    It is probably best to map the MakeDropDown macro to a control key such as CTRL-L (for list).

    Attached is the workbook I used to develop this. Have fun.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-06-2018
    Location
    TX
    MS-Off Ver
    2013
    Posts
    38

    Re: Dropdown With Current sheets in document

    Thank You. Much appreciated, I've tried using the VBA and it worked like a charm. How different would it be if I was trying to instead of using data from worksheets within the same workbook, data from other workbooks with only one worksheet by selecting this data through a drop-down? in the following example, there is one workbook called File Dashboard in a folder on my desktop and 2 workbooks called sample_1 and sample_2. in the "dashboard" workbook cell A1 references to A1 in Sample_1 and Sample_2. ie. "=[Sample_1.xlsx]Sheet1!A1"I've tried having Sample_1 from "=[Sample_1.xlsx]Sheet1!A1" replaced with a cell that has a dropdown to replace it and have the value change as I change the drop-down, unfortunately, all I get is an error. I tried using the "indirect" function but I'm not really getting anywhere. any assistance would be greatly appreciated.

  6. #6
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: Dropdown With Current sheets in document

    Here you are, using formula and a named range, no code required (though technically still a macro). See my attached example. Using this method files still need to be saved as macro enabled despite no code being entered into a VBA project

    As long as you fill the formula beyond the number of rows equal to the number of sheets you have, new sheets will automatically appear in the list as soon as they are added (or will disappear when removed).

    Simply make a data validation drop down list based on the list generated by this formula and you can have a drop down list of sheets any place in the file you want.
    Attached Files Attached Files
    Ways to get help: Post clear questions, explain your overall goal, supply as much background as possible, respond to questions asked of you by those trying to help and post sample(s) files.

    "I am here to help, not do it for people" -Me

+ 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. VBA: In word, Page number of 3 lines below current place in document?
    By rhdean in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-24-2017, 02:19 PM
  2. Compare Sheets and Display the previous sheets column in current sheets
    By maddyrafi1987 in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 05-09-2017, 04:03 AM
  3. Upload current document to http server (using POST)
    By Henkjan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-17-2013, 12:37 PM
  4. Copy Current Worksheet X number of times, as specified in dropdown box
    By Lord_Griffth in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-05-2012, 12:00 PM
  5. [SOLVED] External source from the same folder as current open document
    By Marco-Kun in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-20-2012, 12:53 PM
  6. Custom menu for current document only
    By skyping in forum Word Formatting & General
    Replies: 4
    Last Post: 06-03-2011, 03:16 PM
  7. how do I judge current document is a blank one?
    By Ronnie in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-02-2005, 10:05 AM

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