Excel: Macro Recorder Generates Error with Embedded Chart

Last reviewed: September 2, 1997
Article ID: Q78471

The information in this article applies to:
  • Microsoft Excel for Windows, versions 3.0, and 4.0
  • Microsoft Excel for OS/2, version 3.0

SYMPTOMS

You can record a macro to create an embedded chart on your worksheet based on your current selection. However, if your current selection is non-linear, you will receive the error "Cannot do that command on a multiple selection" when attempting to run the macro.

STATUS

Microsoft has confirmed this to be a problem in the versions of Microsoft Excel listed above. This problem was corrected in version 5.0 of Microsoft Excel for Windows.

MORE INFORMATION

CREATE.OBJECT is the macro command that is used to draw objects on a worksheet. If it is used to create a chart, it must be preceded in the macro by the COPY command. However, you cannot copy a non-linear selection.

Note: A linear selection is one that is aligned either vertically or horizontally.

Steps to Reproduce Problem

  1. Enter the following information into a worksheet:

          A1:             B1: 1987        C1: 1988
          A2: Jan         B2:   3         C2:   2
          A3: Feb         B3:   2         C3:   1
          A4: Mar         B4:   4         C4:   2
    
    

  2. Choose Start Recorder from the Macro menu and choose OK.

  3. Select cells B1:C1. Then, holding down the CTRL key, select cells A2:C4.

  4. Select the Charting icon from the tool bar and create a chart in the worksheet by dragging your mouse.

  5. Select First Row Contains Category (X) Axis Labels in the dialog that appears.

  6. Choose Stop Recorder from the Macro menu.

  7. Select the chart and press the DEL key on your keyboard to remove the embedded chart.

  8. Run the macro by choosing Run from the Macro menu, selecting the macro name, and choosing OK.

You will receive the error message "Cannot do that command on a multiple selection."

WORKAROUND

To correct the problem, you must do either of the following while recording the macro:

  • Make a linear selection (if possible).

    -or-

  • After making the selection, create a separate chart document and then copy and paste the chart information into the worksheet.

For more information on linear selections, query on the following words:

   linear and aligned and excel

REFERENCES

"Microsoft Excel Function Reference," version 3.0, pages 40-41

Additional query Words: 3.00 4.0 4.00 Keywords : kbmacro kbusage PgmHowTo PgmOthr


================================================================================


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: September 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.