Erik Rasmussen
Erik Rasmussen

Reputation: 331

VBA Create a chart from data in an array

I have a sub that that runs a simulation and creates an array with my data. I'd like to make various charts with this data to understand it, but if possible I'd like to avoid pasting the data on worksheet first, is there a way to make a chart directly from the array?

I can paste the data and work around it, but I'm hoping for a more elegant solution

Upvotes: 1

Views: 1914

Answers (1)

GSerg
GSerg

Reputation: 78183

Documentation gives you the answer.

Charts("Chart1").SeriesCollection(1).Values = Array(1, 3, 5, 7, 11, 13, 17, 19)

Upvotes: 1

Related Questions