Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using Arrays as Data for a Chart Series


According to the Excel 2000 online help, the *Add* method for
-SeriesCollection- can accept either a *Range* of objects or an *Array
of data points.

In my case an Array will be easier to use, so I tried:


Code
-------------------

row = 3
col = 10
Dim myArray(20) as double

for n = 1 to 20
myArray(n) = cells(row, col + n)
next n

myChartObject.Chart.SeriesCollection.add source:= myArra
-------------------


When the *add* executes I get a "Run-Time error 1004: Reference is no
valid" error message

The previous code looked like:


Code
-------------------

row = 3
col = 10

set fCell = cells(row, col + 1)
set lCell = cells(row, col + 20)

myChartObject.Chart.SeriesCollection.add source:= range(fCell, lCell)

-------------------


Which worked fine, it just not versital enough for some convoluted
dis-jointed, non-contigious series I'm trying to put together. Fillin
an array would be much easier.

Any thoughts as to what I'm doing wrong

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Using Arrays as Data for a Chart Series

there must be some confusion in the help file:

http://support.microsoft.com/default...53&Product=xlw
XL2000: Cannot Use Array as Source Argument with SeriesCollection

work around code is included.

http://support.microsoft.com/default...87&Product=xlw
XL2000: Cannot Use Array of Data Points with Extend Method

--
Regards,
Tom Ogilvy


"mphare" wrote in message
...

According to the Excel 2000 online help, the *Add* method for a
-SeriesCollection- can accept either a *Range* of objects or an *Array*
of data points.

In my case an Array will be easier to use, so I tried:


Code:
--------------------

row = 3
col = 10
Dim myArray(20) as double

for n = 1 to 20
myArray(n) = cells(row, col + n)
next n

myChartObject.Chart.SeriesCollection.add source:= myArray
--------------------


When the *add* executes I get a "Run-Time error 1004: Reference is not
valid" error message

The previous code looked like:


Code:
--------------------

row = 3
col = 10

set fCell = cells(row, col + 1)
set lCell = cells(row, col + 20)

myChartObject.Chart.SeriesCollection.add source:= range(fCell, lCell)

--------------------


Which worked fine, it just not versital enough for some convoluted,
dis-jointed, non-contigious series I'm trying to put together. Filling
an array would be much easier.

Any thoughts as to what I'm doing wrong?


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using Arrays as Data for a Chart Series


Thanks Tom, that certainly answers my question and provides
work-around I am going to try.


Thanks again

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Using Arrays as Data for a Chart Series

You can add a series using NewSeries, then apply the array directly
without using an intermediate range.

Dim ns as Series
Set ns = ActiveChart.SeriesCollection.NewSeries
With ns
.Values = myArray
.XValues = myOtherArray
.Name = "New Series"
End With

- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______

mphare wrote:

Thanks Tom, that certainly answers my question and provides a
work-around I am going to try.


Thanks again!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using Arrays as Data for a Chart Series

Hi Jon,

I just saw your reply and will give that a try.
The work-around Microsoft provided had some problems as well.

Thanks,

Mike


---
Message posted from http://www.ExcelForum.com/

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not plot a data series in a chart but still display in data table mebp Charts and Charting in Excel 1 March 19th 10 05:13 PM
chart with two data series and two colors for each data series bikash Charts and Charting in Excel 0 January 17th 08 02:04 AM
automatically expand chart data series as data is added jlarson Charts and Charting in Excel 1 March 9th 06 10:31 AM
Using arrays to select a series of cells [email protected] Excel Discussion (Misc queries) 1 December 27th 05 10:47 PM
chart data series -- plot a table as a single series hjc Charts and Charting in Excel 7 September 20th 05 05:52 PM


All times are GMT +1. The time now is 04:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"