View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Q: Best way to take data from VBA into graphs without writing data

You are not completely out of luck: You can use an array to set the "Values"
or "XValues" property of the series on the chart. I don't know how familiar
you are with the object model for Excel charts - it is worth getting to know
it and you can get most of the info you need from the object browser and the
help files. Basically, to set the values for any series, you would reference
it as below (written out in long form):

Workbook(Bookname).Sheets(SheetName).ChartObjects( Index1).Chart.SeriesCollection(Index2).Values = YourArray

The difficulty: the array can only be a one-dimensional array, so you still
need to manipulate your multi-dimensional array and extract the proper values
for the particular series. But it can all be done in VBA.

"KR" wrote:

I have a large array in VBA memory (1 to 3, 1 to 55, 1 to 4, 1 to 18, 1 to
212) filled with various data, some of which I need to dump into graphs.

In the ideal world, I would assign sections of this array to named ranges,
and set the DataSource on my graphs to the appropriate named ranges
(probably 6 at a time, print, update those 6 graphs to the next 6 named
ranges, etc.).

I'd like to avoid dumping the data into a worksheet, because that adds a
layer of complexity trying to manage all the different ranges and then
getting the information into graphs.

Is there an (easy) way to populate graphs directly from numbers in a VBA
array (through named ranges or otherwise), or am I out of luck?

Thanks,
Keith
Using Excel XP/ Windows 2000



--
The enclosed questions or comments are entirely mine and don't represent the
thoughts, views, or policy of my employer. Any errors or omissions are my
own.