vba charting question

G

google

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!
 
T

Tushar Mehta

In your goofing around did you check out the XValues and Values
properties of the Series object?

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Multi-disciplinary business expertise
+ Technology skills
= Optimal solution to your business problem
Recipient Microsoft MVP award 2000-2005
 
G

google

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top