Solved

Excel: option buttons to update chart data

Posted on 2011-02-12
12
266 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
  • 8
  • 4
12 Comments
 
LVL 41

Expert Comment

by:dlmille
Comment Utility
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
Comment Utility
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 41

Expert Comment

by:dlmille
Comment Utility
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
 

Author Comment

by:Maliki Hassani
Comment Utility
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 41

Expert Comment

by:dlmille
Comment Utility
hang on - need 10 mins

Dave
0
 
LVL 41

Accepted Solution

by:
dlmille earned 500 total points
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 41

Expert Comment

by:dlmille
Comment Utility
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
Comment Utility
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
Comment Utility
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 41

Expert Comment

by:dlmille
Comment Utility
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 41

Expert Comment

by:dlmille
Comment Utility
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 41

Expert Comment

by:dlmille
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Word 2010 mail merge 3 32
Outlook 2010 Archive 3 36
Checkbox Notification 3 22
Excel 3 20
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now