+ Reply to Thread
Results 1 to 3 of 3

List Worksheet Scenarios in drop-down via VBA

  1. #1
    Registered User
    Join Date
    01-09-2018
    Location
    denver
    MS-Off Ver
    2017
    Posts
    2

    List Worksheet Scenarios in drop-down via VBA

    I have a rather large financial model that relies on a substantial number of scenarios across multiple worksheets. My goal is to bypass the actual use of the Scenario Manager and control scenario selections from dropdown in several dashboards. I'm new to VBA, however, I've successfully written the code to trigger scenarios from multiple worksheets from drop-downs in a single dashboard. The problem is that the drop-down are driven by tables in which I have to manually maintain once I've created a new scenario. What I'd like to do is programmatically populate the drop-downs by reading the scenarios for a given worksheet with VBA code. That way, I only have to create the scenario(s) and then the dashboard drop-downs will automatically populate with the worksheets scenarios. I've scoured the forums and Microsoft's VBA information and have not found a way to accomplish this.

    My drop-downs are currently using a Data Validation lists tied to a dynamic list going against the manually populated tables. When the value in the drop down changes, my code reads the value of the drop down into a variable and then uses the Worksheet.Scenarios.Show method to trigger the scenario.

  2. #2
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: List Worksheet Scenarios in drop-down via VBA

    Hi fournit,

    I found some code online and changed that for use in a table. for sure you have to adjust to your workbook specifics like worksheetname and tablename etc

    Please Login or Register  to view this content.
    the code deletes the databodyrange of the table each time it is used and rebuilds the list. this is the most practical way in VBA that makes sure the list is always accurate and no old scenarios that may have been deleted stay in the list.

    See attachement to test and play with the code.
    Attached Files Attached Files
    Last edited by Roel Jongman; 12-10-2019 at 04:58 AM.

  3. #3
    Registered User
    Join Date
    01-09-2018
    Location
    denver
    MS-Off Ver
    2017
    Posts
    2

    Re: List Worksheet Scenarios in drop-down via VBA

    Much appreciated Roel and thank you for the quick response! I will work with your sample code today and see if I can work my way through it. I'll let you know if I have any questions.

    Regards,
    Tom

+ 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. two different scenarios in a worksheet change
    By devi1337 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-29-2017, 08:30 PM
  2. List all scenarios that match 2 criteria
    By Willem2904 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-04-2016, 11:52 AM
  3. Display Scenarios Using a drop-down list
    By judasdac in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-23-2014, 12:31 AM
  4. Add worksheet to drop down list
    By cooner3 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-13-2014, 11:53 AM
  5. [SOLVED] Loading a Table in a worksheet from another worksheet by using a drop down list
    By zicitron in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-04-2013, 03:50 AM
  6. Replies: 3
    Last Post: 04-16-2012, 10:14 PM
  7. Drop Down List to Copy Entire Contents of Worksheet into Master Worksheet
    By mrmartin in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-14-2011, 10:54 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