Solved

Excel: option buttons to update chart data

Posted on 2011-02-12
12
276 Views
Last Modified: 2012-05-11
Experts!

I am using Excel 2007 to create a dashboard to show historical data.  My spreadsheet already has the working functionality of listbox that updates charts.  My question is how can I add to the existing code to allow the option buttons change the data on each individual chart?  If I can get an expert to show me on 1 chart I can take it from there.  The issues is that there are many ways but I am looking for the best way since I will have 30 charts to update.  The offset in executive rollup data col IX is what will need to be used to giive some assistance.  Perhaps new columns labeling 1d, 1w, 1m, 3,m, and 6m

The option buttons will be 1d (not ready yet), 1 week, (meaning week4 and week5, basically the way that it is currently set up and the prvious week from that) 1 month, 3 months, 6 month, and 1 yr.

I am currently working with the main dashboard only (Summary dashbord) and the data that is being pulled from is called "Executive Rollup Data".  I am starting to work with chart 115.

Thanks for your help!
 NOC-Reports-r14.xlsm
0
Comment
Question by:Maliki Hassani
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 4
12 Comments
 
LVL 42

Expert Comment

by:dlmille
ID: 34880550
LANCE,

Do you need to have every chart have its own option button, or are all of them going to be looking at the same range?  I ask, because that's a lot of option buttons to keep track of.

You will perhaps want to consider naming your option buttons (rather than the automatically generated name) and your charts as well (as opposed to "Chart 123") and adjust your VBA code accordingly.  As you're having many charts and many option buttons, naming them could be useful.

Chart example - main chart in Summary tab could be called "MAIN"  or "Chart 1" where you number all your charts from the MAIN one going around clockwise.  See this tip from MSFT for changing chart names:  http://office.microsoft.com/en-us/excel-help/rename-a-chart-HA010223127.aspx

This COULD really help you maintaining your code, simplifying instead of you wondering what the chart number is, and having to click on it to find out, or if you DELETE a chart and REPLACE it with a new one, you'd have to change code addressing the chart, versus just naming it to its NAME based on position on the sheet, without having to change code!

The same applies to Option Buttons - you could give each one a name, based on its CHART identifier.  And that would help you in future maintenance/debugging/etc...

Something to reflect on, before you have HUNDREDS of buttons.  E.g., some summary sheets are like others, so the position of the charts and option buttons are the same, you're just duplicating features while content is different.

To change the name of an Option Button - just go into sheet DESIGN mode, then click on an option button to see its properties - you can change the name at the top.

So - if you do this on Summary Dashboard, you'll be able to DUPLICATE all your code to other summary sheets...  Let me know if I'm making any sense.

Dave
0
 

Author Comment

by:Maliki Hassani
ID: 34880599
I think this a great idea...  As for your 1st question I think I am going to have only the larger chart with option buttons, not the smaller charts.. If they want to data mine then they can go to the individual sheets like "surveillance dashboard".   As for the the rest of the sheets I am only going to put the option buttons on the one larger chart (linked to the list box).

This should make it a lot easier I think.  Now the issue is how to control the list box along with the 1d, 1w, 1m ,etc?
0
 
LVL 42

Expert Comment

by:dlmille
ID: 34880609
Yes - I was just noodling how all your option buttons on the one page are in a group, so there is only one selected - so I was going down that route.

Simplified is good - at least till you get your protype working and it gets complicated to have them on different sheets as you don't have firing code developed yet and now I don't have to do that :)

The date range work is already done, I was just tying it to the ob (ob-option buttons).

Dave
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

by:Maliki Hassani
ID: 34880626
Yeah the grouping of the ob would not work .. I had grouped them to navigate around and develop the design.  As I figure the date range would be designed the same as the 8 week range.  I would have to tell it to change from -8 to whatever the required interval would be.  Is that the case?
0
 
LVL 42

Expert Comment

by:dlmille
ID: 34880635
hang on - need 10 mins

Dave
0
 
LVL 42

Accepted Solution

by:
dlmille earned 500 total points
ID: 34880688
Ok - done .

Look at Executive Rollup Data - new columns from IX - JI  (the orange ones help you copy and drag the revised formula in the green range -note optional on showaddr function.

copied the red columns below over for this rollup

option button section in the CODEPAGE of Executive Rollup data - to set an integer value as to offset from last column (which is one day).  E.g., 6 months is the address 5 away from far right.  So the vlookup in the graphing area uses that to determine which range to use.

when option button fired, it sets that variable, then fires the listbox_lostfocus routine which pulls item selected and fires the graph...

obUsed - tells the graphing function whether an ob was used.  If not, it sets the date range to the 2-month window (for all other charts without option buttons) - its hard coded in the generic graphing function.

I think this is now reproduceable to the other summary sheets - just be sure to set the Ranges, after making the new columns (IX to JI).

after saving - go to Summary tab and select date range and it will update chart based on listbox selection and date range specified.

Dave
NOC-Reports-r15.xlsm
0
 
LVL 42

Expert Comment

by:dlmille
ID: 34880693
PS - from an earlier question:  here's a start on a listbox control that allows you to change colors.  It uses the ListView control that I've only started playing with - its an anachronism from earlier versions of Excel.  Creating your own Listbox class is the other alternative (which I'll take a look at as well, in my spare time)  Proceed at your own risk :)

http://www.ozgrid.com/forum/showthread.php?t=20549&page=1

Dave
0
 

Author Comment

by:Maliki Hassani
ID: 34880987
OMG you are by far the best on EE!  Your mod is perfect!  I am looking over everything now.  Just had to tell you that my jaw dropped while I clicked the ob...  :)))
0
 

Author Comment

by:Maliki Hassani
ID: 34881373
Quick question:  I am starting the process of making the smaller charts dynamic.  These chart will be fixed ID's and just update the weekly values.  Should I be defining the names to make ranges like I did in the past?  I tried to select data source and input the cell that has the range but that doesn't work.  Any ideas how I should go about this?
0
 
LVL 42

Expert Comment

by:dlmille
ID: 34881484
why not set them up just like the main chart?

Put one together, hardcoding the range.  Then, post your question (to tie it to a range based on the rules you want to apply).

Dave
0
 
LVL 42

Expert Comment

by:dlmille
ID: 34881605
oh - figure out what the offset equation would be for the series, then go to the series itself in the chart and paste that in.  You're good at offset functions as demonstrated by the chart.  Its essentially what we're doing with the main chart, except I believe you just want to tie it to a fixed timeframe, so its back to the way you originally designed this (without the defined names) - just put the formula directly into the series.

See the tip here as someone else was trying to do the same thing....

http://www.experts-exchange.com/Q_26817857.html

Dave
0
 
LVL 42

Expert Comment

by:dlmille
ID: 34881624
Well, you could use defined names if you wanted.  You just don't HAVE to.  

Apparently MSFT  has no problem with it: http://support.microsoft.com/kb/183446

and might be easier to maintain, if you ever want to change them...

Dave
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

742 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question