Adding DataSeries from Array of Numbers (NOT A SHEET)

All,

I am trying to take an array and use this to add a data series to a chart that is already created my code below:

            Dim arr(ArrayLength - 1) As Integer
            Dim j As Integer

            For j = 1 To ArrayLength
                arr(j - 1) = WorksheetName.worksheets(MetricType).range("C" & dataRow).value
            Next

            chartWorkbook.SeriesCollection.Add(source:=

I am not sure how to set the series source to the array.. how do I do this???

or for simple code:
            Dim arr(2) As Integer
           arr={1,1}

            chartWorkbook.SeriesCollection.Add(source:=

THANKS!!!
sporenzaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
You should be able to add data to a Series this way:

XValues Property
http://msdn2.microsoft.com/en-us/library/aa215988(office.11).aspx

Charts("Chart1").SeriesCollection(1).XValues = Array(5.0, 6.3, 12.6, 28, 50)

Bob
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sporenzaAuthor Commented:
Bob,

Thanks for the solution but my array already has numbers in it, actually there can be thousands of numbers in it and are filled prior so I can not simply write them out as you shown here..

what I mean is in the example i show the array is actually filled with a loop and the array size is dynamic as well as the values in it...

hope you understand.  THanks for your help!
0
Bob LearnedCommented:
That was only an example of using an array.  If you already have the array, then you should be able to assign that to the XValues property.

Bob
0
Computer101Commented:
Forced accept.

Computer101
EE Admin
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.