Hi all,
I am working on a XL Scatter Graph that will automatically update as changes are made to the data. I would appreciate any help with this query.
There are three columns of data, with headers: "item name", "cost", "impact". Each "item name" is the legend or data label of the graph. "cost" is the x axis. "impact" is the y axis.
So, for each "item name", a point will appear on the graph showing the items cost and impact. If any chages are made to either its cost, or impact, the graph will automatically update.
Now, there might be five items that are shown on the graph. If I add a new item to my data it will not appear on the graph, unless I go into the source data, and add a new series.
Is there a way that new items can appear on the graph automatically?
Many thanks, Tom.
Last edited by strongarmtom; 05-01-2009 at 08:53 AM.
Adding new series to a chart is best done via code.
If you did not have the complication of naming each point with text you could have used a single series and a named range formula.
thanks andy. unfortunately i do need the "complication of naming each point". i am familiar with vba code, but have never used it in relation to graphs before. is it possible to use code to create new data series? how can i do this?
Try this,
It uses a listobject as the data source. Single series so data points will automatically appear.
The code part simply updates the data label text to that of the information in the listobject
hey andy, thanks again for your reply.
how do i "add data to listobject"?
if you select a cell in the table you should see a blue border appear which will include a new records * marker.
Or just type in the cell at the end of the list and it will expand
hi,
i'm having some problems here working this out...
the graph looks identical to what i want, only it is minus the data labels.
i can expand the table to include more items that will appear on the graph.
but, how do i get the data labels to appear on the graph?
if i add a new row to the data table, then click update chart, i get an error message that takes me to the vba editor. part of the sub: " Dim objListO As ListObject " is highlighted.
sorry andy, i am fairly proficient on excel, but i've never worked that much with graphs before. if you could please explain what you mean in simple steps i would be much appreciated.
thank you.
Sorry just noticed your using xl2000.
Listobjects did not exist back them
Here is the file with dynamic named ranges and the code adjusted for xl2000.
Select chart and press button
andy, that is awesome. i can't even believe that is possible. excel does some wonderful, wonderful things.
thanks for your help mate. i will spend the next few days trying to understand what you have done.
cheers!!
hi andy, thanks for your help yesterday.
i have one final question: what i need to do, is have the graph on a different sheet to the sheet that has the data.
i have changed the location of the graph and it then produces an error. i have tried to amend the vba code and i also get an error. i think the code may be slightly over my head!!
any further help would be appreciated. thanks.
I'm assuming the error is related to locating the range for the data.
So something like this that specifies exactly which sheet to look on.
Set rngData = Worksheets("Sheet1").Range("A1").CurrentRegion.Columns(1)
ah ha. spot on once again. thanks andy.
Hi Andy,
I stumbled across this after researching a solution to creating a dynamic xy chatterchart with labels.
I tried to use your macro, but when i delete a row, the area of the graph does not move automatically, distorting the data. Is there a way to make it move up automatically, just as you have made it move down?
I use Excel 2007.
Thank you
Last edited by ChristineMF; 04-16-2012 at 10:40 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks