The information in this article applies to:
SYMPTOMSIn Microsoft Excel versions 5.x and 7.0, when you use the SELECT() function in a Microsoft Excel 4.0 macro sheet to select a series on a chart, you may receive either an error message or unexpected results when you run the macro. CAUSE
When you use the SELECT() function to select a chart series, for
example SELECT("S1"), the series number is the order in which the
series data appears on the supporting worksheet, not necessarily the
series order that you have given the series data.
WORKAROUNDIf you are writing a macro that you need to run in Microsoft Excel versions 4.0, 5.0, and 7.0, and the syntax that you need to use depends on the version in which the macro is running. You can use the GET.WORKSPACE() function to determine the version, and then use the appropriate syntax as in the following example:
Because the GET.WORKSPACE(2) command returns the version of Microsoft
Excel that you are running, you can use this to take the appropriate
action. In the above macro command, if the version of Microsoft Excel
is less than 5.0, the first series is selected, otherwise, the fourth
series is selected.
MORE INFORMATIONNote that if you use the SeriesCollection method with the Select method in a Visual Basic macro, the series with the series order number that you specify is returned. For example, the following macro selects series one on the active chart.
Microsoft provides examples of Visual Basic procedures for
illustration only, without warranty either expressed or implied,
including but not limited to the implied warranties of
merchantability and/or fitness for a particular purpose. This Visual
Basic procedure is provided 'as is' and Microsoft does not guarantee
that it can be used in all situations. Microsoft does not support
modifications of this procedure to suit customer requirements for a
particular purpose. Note that a line that is preceded by an
apostrophe introduces a comment in the code--comments are provided to
explain what the code is doing at a particular point in the
procedure. Note also that an underscore character (_) indicates that
code continues from one line to the next. You can type lines that
contain this character as one logical line or you can divide the
lines of code and include the line continuation character. For more
information about Visual Basic for Applications programming style,
see the "Programming Style in This Manual" section in the "Document
Conventions" section of the "Visual Basic User's Guide."
REFERENCESFor more information about SELECT, choose the Search button in Microsoft Excel Macro Functions Help and type: SELECT function Additional query words: 5.00c PATTERN()
Keywords : |
Last Reviewed: October 5, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |