• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

dynamic chart with drop down list for two charts on one graph

mhghg

Member
Hi guys,
I like to use drop down list to select the charts, for example if I select DB/PS from cell D8,
It will update with the corresponding chart, but i dont have to draw all of them out
Please share some lights to my darkness.
Thanks,
Macy
 

Attachments

  • dynamic chart.xlsx
    17.9 KB · Views: 9
Macy

upload_2016-9-8_15-38-32.png
Have a look at the attached file

Can you explain what ranges the lstGroup should be?
 

Attachments

  • dynamic chart.xlsx
    14.5 KB · Views: 6
Hi guys,
Thank you very much for all respond. Yesterday I tried to work out the solution by myself and I am coming up with this excel sheet. I am using combo box to control user selection. The thing I like is When I select the option in combo box, say DB/PS then it will auto select the %DB/PS in combo box 2. The combo box 2 will be grey out so it looks like only one drop down list.
Here is my version. Any idea, formula vba script ..?
 

Attachments

  • dynamic chart-Version3.xlsx
    17.9 KB · Views: 23
I don't believe that you can change the color of Drop Downs as you want

You can reset it's value when the other drop down changes

add the following code to a Code Module in VBA

Code:
Sub DropDown4_Change()
[R16] = [Q16]

End Sub
 
Hi Hui,
I have added the vba code into the module, but I when select the option from one drop down list the other does not change at all. Is that the way you did or did you do differently?
Macy
 
Sorry
Right click on the M3 Dropdown and Assign Macro
Select the DropDown4_Change macro
 
Works great Hui... but the only question is why the need for a macro or for that matter the second drop box when the same result can be achieved by just using an "If" formula....
 
Try it
If you use a formula and then manually change the second Drop Down it will erase the formula
 
You only need the second drop down if you want to view different data
 
You only need the second drop down if you want to view different data
Hi Guys,
Thank you very much. It works well. I also learn 3 things today.
1. Choose formula.
2. Simple vba
3. Offset function
4. Beautiful graphing technique

Both of Choose and Offset function are great, but I worry the users can mess around with the formulas unless we create and hide them in different sheet.

Have a good weekend :)
Macy
 
Last edited:
Your use of Named Formula on Sheet2 in your file is the recommended way to go if you don't want people playing with worksheet formulas

Although the Offset function is a great and simple function to understand it is Volatile and so is recalculated whenever anything on the worksheet changes

You are better to use the Index function which can return a Row or Column of data simply

see your file modified to use Index
 

Attachments

  • Dynamic chart-Version3-2.xlsx
    19 KB · Views: 25
Back
Top