Can a graph use array data instead of ranges?

  • Thread starter Thread starter y
  • Start date Start date
Y

y

I would create a graph manipulating the source data range for x and y.
Is it possible to do this?

And how? I always passed to XValues a range type. But if I an array? I don't want to lean to
worksheet cells.

Thanks in advance, Alex.
 
Hi Alex,

Currently I am researching the issue, I will get back here and update you
with new information ASAP.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Alex,

We can add a chart into the workbook and set its series based on array.

Here is the code you may run on the VBA environment of Excel to see if that
is what you want.

Sub Test()
Charts.Add
ActiveChart.ChartType = xlXYScatterLines
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = Array(1, 3, 5, 7, 11, 13, 17,
19)
ActiveChart.SeriesCollection(1).Values = Array(1, 3, 5, 7, 11, 13, 17,
19)
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).XValues = Array(11, 13, 17, 19, 1, 3,
5, 7)
ActiveChart.SeriesCollection(2).Values = Array(1, 3, 5, 7, 11, 13, 17,
19)
End Sub



Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Alex,

Have you tried my suggestion?
Did that works for you?
If you still have any cocern on this issue, please feel free to let me know.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top