Open In App

Assigning Excel Macro to Objects

In Excel, a recorded macro can be assigned to different objects like a shape, graphic, or control note. Instead of running the macro from the required tool in ribbon, we can create these objects to run them easily. They get very handy when multiple macros are there. Individual objects can be created for different macros. 

In this article, let’s discuss how can we assign macros to different objects :



1. Assigning Macro to a Shape

It is one of the easiest ways to run a macro is to create any shape in the worksheet and use it for running the macro.

The steps that need to be followed are:




The work is done! Now the shape would work as a button and whenever you click on it, it will run the assigned macro.

2. Assigning a Macro to a Graphic

In Excel, there is a pool of graphics from which we can choose. There are 3-D models, Icons, pictures, shapes, and much more which can be added to the sheet as required. These graphics have a special feature i.e Macro can be assigned to them and can run macro whenever needed. 

The steps that need to be followed are:

Now, our graphic is ready to use. Just click on the graphic to run the assigned macro.

3. Assigning a Macro to a Control

We can also create a control button to assign a particular macro to it and when a user clicks it, the control button performs the desired set of actions. 

Let’s understand how can we implement this:

The button which appears on the sheet has default settings, and you can’t format it like the colour, shape of the button. However, the text which appears on the button can be changed. Just a right-click on the button and a dialog box would open.

These are some objects to which a macro can be assigned. 

Article Tags :