XL: Grouped Drawing Objects Run Separate Macros

ID: Q160004

The information in this article applies to:

SYMPTOMS

When you group two or more drawing objects on a worksheet, assign separate macros to each of the different objects that make up the group, and then click an object in the group, Microsoft Excel runs the macro that is assigned to the object you clicked.

CAUSE

You cannot run one macro that is assigned to a group of objects when you click an object that belongs to a group (unless you assign the same macro to each object in the group).

WORKAROUND

If you want each object in a group to run the same macro, and each object is assigned to a separate macro, ungroup the set, reassign the same macro to each object, and then regroup the objects.

MORE INFORMATION

Grouping Objects

1. Select the circle.

   NOTE: If you assigned a macro to the circle, hold down CTRL,
   and then click the circle.

2. Hold down SHIFT, and then click the rectangle.

   NOTE: If you assigned a macro to the rectangle, press CTRL+SHIFT as you
   click the rectangle. In Microsoft Excel for the Macintosh, press
   COMMAND+SHIFT as you click the rectangle.

   This step selects both objects on the worksheet.

3. If the Drawing toolbar is not visible, point to Toolbars on the View
   menu, and then click Drawing.

4. In Microsoft Excel 97 or Microsoft Excel 98, click Draw on the Drawing
   toolbar, and then click Group. In Microsoft Excel 5.0 and 7.0, click
   Group Objects on the Drawing toolbar.

   The two objects are grouped.

NOTE: Steps 1 through 3 are the same in Microsoft Excel 97 and Microsoft Excel 5.0 and 7.0.

Ungrouping Objects

1. Select the group.

   NOTE: If you assigned macros to the objects in the group, press CTRL as
   you click any object in the group.

2. If the Drawing toolbar is not visible, point to Toolbars on the View
   menu, and then click Drawing.

3. In Microsoft Excel 97 or Microsoft Excel 98, click Draw on the Drawing
   toolbar, and then click Ungroup. In Microsoft Excel 5.0 and 7.0, click
   Ungroup Objects on the Drawing toolbar.

   The two objects are ungrouped.

NOTE: Steps 1 and 2 are the same in Microsoft Excel 97 and Microsoft Excel 5.0 and 7.0.

REFERENCES

For more information about grouping objects, click the Index tab in Microsoft Excel 97 Help, type the following text

   grouping, drawing

and then double-click the selected text to go to the "Group, ungroup, regroup drawing objects" topic.

Additional query words: 5.00 7.00 XL98 XL97 XL7 XL5

Keywords          : kbprg kbtool kbdta xldraw PgmOthr KbVBA 
Version           : WINDOWS:5.0,7.0,97; MACINTOSH:5.0,98
Platform          : MACINTOSH WINDOWS
Issue type        : kbprb

Last Reviewed: January 2, 1999