Charting data generagted by a Sub. Urgent please.

B

BEETAL

How to create a chart by using the data generated by a Sub.

I don't want to paste the data on a spreadsheet. I want to plot the data
after it is calculated without pasting it.

Is it possible.
 
J

Jon Peltier

It's possible. Create the chart, remove any series it contains by default,
then use this to add and populate each series from arrays of data you've
calculated:

With ActiveChart.SeriesCollection.NewSeries
.Values = MyYArray
.XValues = MyXArray
End With

Note that you are limited to how many characters it takes to represent an
array as a string of the form ={1.234567890,2.345678901,3.456789012}. You
can reduce the length of this string somewhat (see
http://peltiertech.com/Excel/ChartsHowTo/DelinkChartData.html).

It's also difficult to debug the code when you're dealing with arrays you
cannot see.

Charts work better with worksheet data. It's easier and better to use
worksheet ranges as chart source data. Put the data into a hidden sheet if
necessary.

- Jon
 

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