XL98: Cannot Use Array of Data Points with Extend Method

Last reviewed: March 9, 1998
Article ID: Q182242
The information in this article applies to:
  • Microsoft Excel 98 Macintosh Edition

SUMMARY

In Microsoft Excel 98 Macintosh Edition, the Help topic for the Extend method states that the Source argument may be either a Range object or an array of data points. This information is incorrect; the Source argument must be a Range object.

If you run a Visual Basic for Applications macro that attempts to use an array of data points for the Source argument of the Extend method, you receive the following error message:

   Run-time error '1004':
   Reference is not valid.

MORE INFORMATION

In Microsoft Excel, you can use the Extend method to add new data points to an existing series in a chart. For example, if you create a simple column chart that contains a single series, and you want to add new data points to the series, you can use a line of code similar to the following:

   ActiveChart.SeriesCollection.Extend Worksheets("Sheet1").Range("B5:B6")

This line of code adds the values in cells B5:B6 in Sheet1 to the chart.

If you specify an array of data points for the Source argument of the Extend method, you receive an error message. For example, the following sample code causes the problem:

   Dim xExtras
   xExtras = Array(2, 3, 5, 7)
   ActiveChart.SeriesCollection.Extend xExtras

The problem occurs because xExtras refers to an array of data points, not to a Range object.


Additional query words: XL98
Keywords : kbprg kbdta kbdtacode xlvbahowto xlvbainfo xlchart xlhelp
Version : MACINTOSH:98
Platform : MACINTOSH
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 9, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.