ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can a graph use array data instead of ranges? (https://www.excelbanter.com/excel-programming/296131-can-graph-use-array-data-instead-ranges.html)

y

Can a graph use array data instead of ranges?
 
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.


Peter Huang

Can a graph use array data instead of ranges?
 
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.


Peter Huang

Can a graph use array data instead of ranges?
 
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 Whe=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.


Peter Huang

Can a graph use array data instead of ranges?
 
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.



All times are GMT +1. The time now is 09:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com