Excel: Xy_series Argument in NEW() Ignored with Chart TemplateLast reviewed: November 30, 1994Article ID: Q70217 |
The information in this article applies to:
SUMMARYWhen you use the NEW() function in conjunction with a chart template, it does not matter what you specify for the xy_series argument. Microsoft Excel for Windows Versions 3.0 When you open a chart template and your data does not contain column field names, you will automatically be prompted with the First Row Contains dialog box regardless of the argument you specify for the xy_series in the NEW() function.
WORKAROUNDIf you do not want the First Row Contains dialog box to appear, you can add a SEND.KEYS() statement immediately before the NEW() command, as in the following example:
=SEND.KEYS("c~") =NEW("chart_template")In this example, the SEND.KEYS() commnad selects the Category (X) Axis Labels option from the First Row Contains dialog box. Microsoft Excel then performs the NEW() macro command and displays the new chart created with the first row/column containing the category (x) axis labels. To use the SEND.KEYS() command to select the First Data Series option from the First Row Contains dialog box, use the following syntax:
=SEND.KEYS("f~")Microsoft Excel for Windows Version 4.0, 4.0a In Microsoft Excel for Windows, versions 4.0 and 4.0a, when you use the NEW() function to open a chart template, Microsoft Excel does not display the New Chart Dialog Box at all. Microsoft Excel creates the chart based on the chart template type, and the selected data. The xy_series argument is ignored. If the chart template is an xy (scatter)chart, then the created chart is an xy (scatter). However, if the chart template is not an xy (scatter), then the selected data determines how the data is arranged in the chart. In the following examples, the same chart template used with two different data selections result in different charts, even though the same macro command is used to create the charts. By default, if the first row or column contains text, this row or column is used for the category (x) axis labels.
Example 11. In a new worksheet, enter the following data:
A1: Dec B1: Jan C1: Feb A2: 1 B2: 10 C2: 2 A3: 2 B3: 20 C3: 4 A4: 3 B4: 30 C4: 6
=NEW("Chart_Template",2) =RETURN() Because the first row contains text, the macro correctly uses the second argument and creates a chart that uses the first row of the selected data as the category (x) axis labels.
Example 2
WORKAROUNDTo create a new chart with the first row of data used for the X-axis labels using data similar to that in Example 2, use the following macro:
=COPY() =NEW("Chart_Template",2) =PASTE.SPECIAL(1,FALSE,TRUE,FALSE) =RETURN()This macro copies the selected worksheet data, opens the chart template and pastes the data into the chart. The PASTE.SPECIAL() command specifies that the data series are in rows and that the first row is to be used for X-Axis labels. NOTE: The arguments in the PASTE.SPECIAL() command above may need to be changed, depending on the how your data is laid out in the worksheet. For example, to specify that the data series are in columns and that the first column is to be used for X-Axis labels, use the following PASTE.SPECIAL() command:
=PASTE.SPECIAL(2,FALSE,TRUE,FALSE) MORE INFORMATIONThe syntax of the NEW() function is as follows:
NEW(type_num, xy_series, add_logical)The xy_series argument allows you to designate four arguments where:
0 Displays dialog box if selection is ambiguous. 1 First row/column is the first data series. 2 First row/column are the category (x) axis labels. 3 First row/column are x-values; created chart is a scatter chart.This argument is designed to allow you to choose how you want your data arranged in a chart.
REFERENCES"Function Reference," version 4.0, pages 285-286, 318 "Function Reference," version 3.0, page 159, 178
|
KBCategory: kbusage
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |