Error: Unable to set the Xvalues property of the series class

S

samir

I have VBA code that generates a paired-vectors of variant/varian
arrays A and B. I want to plot this A vs B on XYScatter chart for 4
different paired-vectors of A and B directly on the Chart. Each o
these A (and B) vectors are 360 elements long.

e.g.
For i = 1 to 40
Ai = -variant/variant array of 360 elements-
Bi = -variant/variant array of 360 elements-

With ActiveChart
.ChartType = xlXYScatter
Set ns = .SeriesCollection.NewSeries
With ns
.name = "A and B " & i
.XValues = Ai '->>>>
_this_is_where_I_get_the_abovementioned__Error_ -
.Values = Bi End With End With
Next i

Any help is greatly appreciated.
I looked at Jon Pieltier's website where there is an example o
plotting multiple X Y series with different X and Y values but eithe
XValues are read in from a Worksheet Range or XValues are directly se
as -
.XValues = Array(10,20,30)

Neither of which are helpful here as my arrays are already created fro
some other VBA macro so I can't use "Array" function and writing to th
worksheet and reading back seems unnecessary.
THANKS FOR YOUR TIME AND QUICK HELP
Cheers,
Sami
 
J

Jon Peltier

Samir -

If your arrays are greater than about 240 characters, you're not going to be able to
use them directly. Formulas in Excel cannot exceed 1024 characters, and apparently
this is split into four parts, for the four elements of a SERIES formula.

Putting the values into a worksheet might seem unnecessary, but it's really the only
way to handle a large array. (The ARRAY function was just a simple way to create a
VBA array for the example.)

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 

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