4 Ways to Create a Button and Assign It a Macro in Excel

Table of contents:

4 Ways to Create a Button and Assign It a Macro in Excel
4 Ways to Create a Button and Assign It a Macro in Excel
Anonim

Excel macros are very useful tools that save you time when you need to perform a sequence of repetitive operations. By assigning a macro to a custom button, you can speed up your work even further as it only takes a click of the mouse to execute it.

Steps

Method 1 of 4: Use Excel 2003

Create a Custom Macro Button in Excel Step 1
Create a Custom Macro Button in Excel Step 1

Step 1. Click the Tools menu and select the option Customize.

Create a Custom Macro Button in Excel Step 2
Create a Custom Macro Button in Excel Step 2

Step 2. Click the "Toolbars" tab

Create a Custom Macro Button in Excel Step 3
Create a Custom Macro Button in Excel Step 3

Step 3. Click on the "New" button

Create a Custom Macro Button in Excel Step 4
Create a Custom Macro Button in Excel Step 4

Step 4. Type the name you want to give your new toolbar

Create a Custom Macro Button in Excel Step 5
Create a Custom Macro Button in Excel Step 5

Step 5. Click on the "OK" button

Create a Custom Macro Button in Excel Step 6
Create a Custom Macro Button in Excel Step 6

Step 6. Click the "Commands" tab

Create a Custom Macro Button in Excel Step 7
Create a Custom Macro Button in Excel Step 7

Step 7. Select the "Macros" item from the left pane of the "Commands" tab

Create a Custom Macro Button in Excel Step 8
Create a Custom Macro Button in Excel Step 8

Step 8. Drag the Custom Button icon from the right pane of the "Commands" tab to the new toolbar you just created

The custom button icon has a yellow smiley face.

Create a Custom Macro Button in Excel Step 9
Create a Custom Macro Button in Excel Step 9

Step 9. Select the new button with the right mouse button

Create a Custom Macro Button in Excel Step 10
Create a Custom Macro Button in Excel Step 10

Step 10. Rename the newly created button to whatever name you like (or you can keep the default)

If you have chosen to rename it, enter the new name in the "Name:" text field.

Create a Custom Macro Button in Excel Step 11
Create a Custom Macro Button in Excel Step 11

Step 11. Click the "Edit Button Image" option

.. and choose whether or not to change the default button image.

The Excel image editor uses controls very similar to the Windows Paint program.

Create a Custom Macro Button in Excel Step 12
Create a Custom Macro Button in Excel Step 12

Step 12. Click on the "Assign Macro" item

Create a Custom Macro Button in Excel Step 13
Create a Custom Macro Button in Excel Step 13

Step 13. Select one of the macros you created earlier using the appeared list

Create a Custom Macro Button in Excel Step 14
Create a Custom Macro Button in Excel Step 14

Step 14. Click on the "OK" button

Create a Custom Macro Button in Excel Step 15
Create a Custom Macro Button in Excel Step 15

Step 15. Now click on the "Close" button in the "Customize" dialog box

Method 2 of 4: Use Excel 2007

Create a Custom Macro Button in Excel Step 16
Create a Custom Macro Button in Excel Step 16

Step 1. Click the small down arrow icon on the right of the Excel 2007 Quick Access Toolbar

Create a Custom Macro Button in Excel Step 17
Create a Custom Macro Button in Excel Step 17

Step 2. Click the More Commands option

..

Create a Custom Macro Button in Excel Step 18
Create a Custom Macro Button in Excel Step 18

Step 3. Select the Macro item from the list in the drop-down menu Choose commands from.

Create a Custom Macro Button in Excel Step 19
Create a Custom Macro Button in Excel Step 19

Step 4. Now select the macro you want to use from the list in the left pane of the window, then click on the "Add" button

Create a Custom Macro Button in Excel Step 20
Create a Custom Macro Button in Excel Step 20

Step 5. Select the macro you just added to the right pane of the window and click the "Edit" button

Create a Custom Macro Button in Excel Step 21
Create a Custom Macro Button in Excel Step 21

Step 6. Click on the image you want to assign to the button linked to the selected macro, type the name that will be displayed on the button in the Display Name text field and finally click on the button OK.

Method 3 of 4: Use Excel 2010

561154 22
561154 22

Step 1. Make sure the "Developer" tab of the Excel ribbon is visible

It is located at the top of the program window. If the card in question is not visible, follow these instructions:

  • Click on the "File" menu, choose "Options" and select "Customize Ribbon".
  • Find the "Development" checkbox listed in the "Main Tabs" box and click it with the mouse. As a last step, press the "OK" button.
561154 23
561154 23

Step 2. Add a "New Group" to the "Development" tab to create a custom group of options in which to insert the button of the macro you are going to create

561154 24
561154 24

Step 3. Remaining in the "Customize Ribbon" tab, click the "Choose commands from" drop-down menu and select the "Macros" option

At this point all the macros you recorded previously will be displayed in the left pane of the window.

561154 25
561154 25

Step 4. Select the macro you want to assign to the new button you are going to create (make sure the new group you added is highlighted

You will know that the macro has been assigned correctly when the corresponding name will appear in the right pane of the window below that of the selected group).

561154 26
561154 26

Step 5. At this point you can customize the button in question

Select it with the right mouse button and choose "Rename".

561154 27
561154 27

Step 6. After customization is complete, click on the "OK" button

Method 4 of 4: Use Excel 2013

561154 28
561154 28

Step 1. Make sure the "Developer" tab of the Excel ribbon is visible

It is located at the top of the program window. If the card in question is not visible, follow these instructions:

  • Access the "Excel" menu, choose the "Preferences" option, then click on the "Ribbon and Quick Access Bar" item (it is located in the "Sharing and Privacy" section).
  • Select the "Development" checkbox listed in the "Main Tabs" pane of the "Customize Ribbon" section, then click the "OK" button.
561154 29
561154 29

Step 2. Click on the "Development" tab, then click the "Button" item

The latter icon is listed in the "Form Controls" menu of the "Insert" option of the "Developer" tab and is characterized by a small rectangular button.

561154 30
561154 30

Step 3. Place the newly created button where you want it

Place it in the place of the interface you prefer, then drag the anchor points to resize it according to your needs. You can zoom in or out as you like. After placing it, you can still choose to move it to another point in the window at any time.

561154 31
561154 31

Step 4. Assign a macro to the button when prompted

Excel should automatically ask you to assign a macro to the new button as soon as you place it where you want it. After selecting the macro in question, click on the "OK" button.

If you don't use macros frequently or if you want to find out how to record one, read the articles indicated. Before you can create a button to run a macro, it must have already been created

561154 32
561154 32

Step 5. Customize the new button

Select it with the right mouse button and choose the "Format Control" option. Select the "Properties" item, choose the "Do not move or resize with cells" option and click the "OK" button. This way the button cannot be moved or resized. Without selecting the indicated option, the position and size of the button will automatically change if you add, delete or move cells.

561154 33
561154 33

Step 6. Rename the button

Change the text displayed inside the button to the name of your choice.

Advice

  • If you are using a version of Excel that is earlier than Excel 2003, still try to use the sequence of steps described in the method of the corresponding article.
  • Alternatively, using Excel 2003 or an earlier version you can add a button to run the macro directly on the existing toolbar.
  • If you wish, you can also assign a hotkey combination to run the macro. This way you can save time and effort.

Warnings

  • The user interface of earlier versions of Excel 2003 may differ from that of this latest version, so the steps described for creating and using a macro in Excel 2003 may not be accurate when used in earlier versions of the program.
  • If you need to use a button icon other than the one that Excel 2007 offers, you will need to download and install additional software that can modify Excel user interface elements.

Recommended: