![]() |
vba charting question
Suppose I have three range objects, call them XRange, DataRange and
DataLabelsRange. - XRange is a series of months, e.g. Jan 2005, Feb 2005 ... etc. - DataRange contains several series of data for each month. For example data for North Sales, South Sales, etc. - DataLabelsRange contains the actual labels "North Sales", "South Sales", etc. The goal is use VBA to create a chart from this ranges with the months on the x axis, lines for each of the series on the y axis, and a legend labeling the lines for you. Pretty simple, no? But after goofing around with the seriescollection object for a couple of hours I can't figure it out. For reasons I won't go into, I can't just select these three ranges as one block and have Excel figure out the rest. I need to take these three separate ranges and somehow meld them into a graph using VBA. Any advice would be much appreciated--thanks! |
vba charting question
This page has some simple VBA examples that should get you started:
http://peltiertech.com/Excel/ChartsH...kChartVBA.html - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ wrote in message oups.com... Suppose I have three range objects, call them XRange, DataRange and DataLabelsRange. - XRange is a series of months, e.g. Jan 2005, Feb 2005 ... etc. - DataRange contains several series of data for each month. For example data for North Sales, South Sales, etc. - DataLabelsRange contains the actual labels "North Sales", "South Sales", etc. The goal is use VBA to create a chart from this ranges with the months on the x axis, lines for each of the series on the y axis, and a legend labeling the lines for you. Pretty simple, no? But after goofing around with the seriescollection object for a couple of hours I can't figure it out. For reasons I won't go into, I can't just select these three ranges as one block and have Excel figure out the rest. I need to take these three separate ranges and somehow meld them into a graph using VBA. Any advice would be much appreciated--thanks! |
vba charting question
Thanks Jon. I actually visited your site before posting, but I'm still
a little confused. Here's what my data looks like: date1 date2 date3 seriestitle1 seriestitle2 series data range A seriestitle3 ---------------------------------------------------- seriestitle4 seriestitle5 series data range B seriestitle6 I have used VBA to identify the ranges corrseponding to A and B. I could use the setsourcedata method to graph data range A with titles and dates. But I can't do that for data range B. Your website says, "You are not limited to using SetSourceData to define the data being charted. You can add the series one-by-one, selecting the precise data you want, not what Excel will assume you want." It would be extremely helpful if you could give me a hint on how to do this. |
vba charting question
Pick one of these techniques:
http://peltiertech.com/Excel/ChartsH...html#addseries and put it into a loop which iterates each series. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ wrote in message oups.com... Thanks Jon. I actually visited your site before posting, but I'm still a little confused. Here's what my data looks like: date1 date2 date3 seriestitle1 seriestitle2 series data range A seriestitle3 ---------------------------------------------------- seriestitle4 seriestitle5 series data range B seriestitle6 I have used VBA to identify the ranges corrseponding to A and B. I could use the setsourcedata method to graph data range A with titles and dates. But I can't do that for data range B. Your website says, "You are not limited to using SetSourceData to define the data being charted. You can add the series one-by-one, selecting the precise data you want, not what Excel will assume you want." It would be extremely helpful if you could give me a hint on how to do this. |
All times are GMT +1. The time now is 04:44 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com