+ Reply to Thread
Results 1 to 11 of 11

Display Scenarios Using a drop-down list

  1. #1
    Registered User
    Join Date
    11-14-2008
    Location
    Brooklyn, NY, USA
    Posts
    53

    Display Scenarios Using a drop-down list

    Hi, I'm trying to replicate the VBA code for displaying scenarios using a drop-down list that I found on this website: http://www.tvmcalcs.com/blog/comment...rop_down_list/

    However, I've not quite been able to get it to work on my worksheet. This is my code:

    Please Login or Register  to view this content.
    What happens is that the scenario in cell G9 changes, but the changing cells (D23:F24,D26:F27,D29:F33) in my three scenarios do not. Any ideas? I'm just getting into the writing VBA and macros and am stumped at this point.

    I've attached my worksheet.

    Cheers and thanks in advance for the help!

    Tim
    Last edited by judasdac; 02-17-2009 at 05:23 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Display Scenarios Using a drop-down list

    Hello judasdac,

    The control in the example was a Forms drop down control. Your workbook has a Control Toolbox ComboBox control. The code from the original post won't work with your control. Here is the correct code.
    Please Login or Register  to view this content.
    How To Save the Macro
    1. Copy the macro using CTRL+C keys.
    2. Open your Workbook and Right Click on the Worksheet's Name Tab for the Worksheet the macro will run on.
    3. Left Click on View Code in the pop up menu.
    4. Paste the macro code using CTRL+V
    5. Make any custom changes to the macro if needed at this time.
    6. Save the macro in your Workbook using CTRL+S
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    11-14-2008
    Location
    Brooklyn, NY, USA
    Posts
    53

    Re: Display Scenarios Using a drop-down list

    Leith --- thanks for the prompt and helpful response! I'm still having a bit of a problem. While it seemed to be working okay when I selected a different scenario from the combo box --- say selecting 15% instead of 20% --- I got a runtime error '1004' that stated "unable to get the scenarios property of the worksheet class."

    I believe the code to be exactly that which you indicated. This is what I have:

    Please Login or Register  to view this content.
    Any ideas?

  4. #4
    Registered User
    Join Date
    11-14-2008
    Location
    Brooklyn, NY, USA
    Posts
    53

    Re: Display Scenarios Using a drop-down list

    Got it! Realized that the name of the scenarios that I had set up in scenario manager didn't match what I had called them on the worksheet itself.

    Thanks again for the help!

    Cheers

  5. #5
    Registered User
    Join Date
    07-29-2011
    Location
    San Diego
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Display Scenarios Using a drop-down list

    Quote Originally Posted by judasdac View Post
    Leith --- thanks for the prompt and helpful response! I'm still having a bit of a problem. While it seemed to be working okay when I selected a different scenario from the combo box --- say selecting 15% instead of 20% --- I got a runtime error '1004' that stated "unable to get the scenarios property of the worksheet class."

    I believe the code to be exactly that which you indicated. This is what I have:

    Please Login or Register  to view this content.
    Any ideas?
    Hello! I saw this post and am having the exact same issue. . .I tried both forms of the code above. I have created a combo box which lists all of my scenarios in a drop down, but the data does not change when I select them. I can't attach my worksheet, but any advice on what to check for or try next would be greatly appreciated.

    Thanks!

  6. #6
    Registered User
    Join Date
    11-19-2013
    Location
    London
    MS-Off Ver
    Excel 2008
    Posts
    1

    Re: Display Scenarios Using a drop-down list

    Hi guys, I tying to setup scenario's using a drop down box - as describe above - but I'm using Excel 2008 for Mac. It seems the VBA editor is not supported in this version. Anyone know a work around?

  7. #7
    Registered User
    Join Date
    06-07-2014
    Posts
    1

    Re: Display Scenarios Using a drop-down list

    projections.xlsm

    hi everyone

    im trying to link the dropdown box into scenario manager, which ive managed to set up! but cant link the dropdown to the scenarios?? any suggestions or advice appreciated.

    thanks very much
    Last edited by younisimran; 06-07-2014 at 01:54 PM.

  8. #8
    Registered User
    Join Date
    09-22-2014
    Location
    VIC, Australia
    MS-Off Ver
    2007
    Posts
    6

    Re: Display Scenarios Using a drop-down list

    Hi everyone,

    I've come across a similar problem to judasdac (I've followed the same blog, but have been using Excel 2007). I've Just read your helpful solution above Leith and was wondering if you (or anyone else) could tell me how to correctly write the VBA code for a combo box (form control). I've attached my workbook.

    When I run the VBA code it works once when it is run from VBA but it doesn't update when I try to do so from combo box on sheet thereafter (it reads message error "400"). I'd be grateful if you had any advice!! Thanks in advance.

    W
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by Woopy; 09-22-2014 at 11:52 PM.

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Display Scenarios Using a drop-down list

    Hello Woopy,

    In order to help you, I need to see the workbook. If the workbook contains sensitive or confidential material, please redact it before posting the workbook.

    If you are unable to do so, you can contact me by private message to email the workbook to me. All information and code that is not of a sensitive or confidentail nature will be posted for the benefit of the forum.

  10. #10
    Registered User
    Join Date
    09-22-2014
    Location
    VIC, Australia
    MS-Off Ver
    2007
    Posts
    6

    Thumbs up Re: Display Scenarios Using a drop-down list

    Hello Leith!

    Totally understand - I have done so and attached workbook above (to my edited original post) and again below.

    Thanks again.
    Attached Files Attached Files

  11. #11
    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,933

    Re: Display Scenarios Using a drop-down list

    Woopy, 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)

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