Excel: Macro Recorder Generates Error with Embedded Chart

ID: Q78471


The information in this article applies to:
  • Microsoft Excel for Windows, versions 3.0, 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
Version : WINDOWS:3.0,4.0; :3.0
Platform : WINDOWS
Issue type :


Last Reviewed: October 25, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.