Share via

passing array to a graph vba

Anonymous
2012-11-22T13:27:04+00:00

Hello,

having an array arr(0 To 11, 0 To 12), how do I pass the values of the first column to a chart (Y),

0,0:11,0?

Thanks

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2012-11-22T16:05:37+00:00

Declare a second array, populate it in a loop and use it for the chart, e.g.

    Dim arr2(0 To 11) As Double

    Dim i As Long

    For i = 0 To 11

        arr2(i) = arr(i, 0)

    Next i

    ActiveChart.SeriesCollection(1).Values = arr2

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2012-11-24T12:02:42+00:00

    hello,

    looking around I found this method:

    yourgrapharr = Application.Index(myarr, 0, 1)

    this will pass cloumn 1 in the array.

    Change 1 to 2 and you'll pass the second etc

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments