Add a Macro Button to the Ribbon
To assign a macro to a custom command button, right-click anywhere on the ribbon, and select Customize the Ribbon… from the pop-up menu.
This will open Customize the Ribbon pane of the Excel Options dialog box.
On the Customize the Ribbon pane, you have two list boxes. On the right, you have the list box that shows your current tabs - Main Tabs . On the left, you have the command buttons that you can add to the ribbon. To expand a group in the Main Tabs list box, click on the plus sign (+) to the left of an item. To collapse a group, click on the minus sign (-).
Note: You cannot add or remove the default commands on the ribbon, but you can uncheck them on the list to prevent them from being displayed. Also, you cannot add command buttons to the default groups. You must create a new group to add a new command button to an existing tab.
Creating a new custom group
You can add the macro button to a new custom group in one of the default tabs on the Ribbon or to a new custom tab you have created for your macro buttons. We’ll go through creating a new tab and then adding a command button to it.
  1. To create a new tab , click the New Tab button at the bottom of the Main Tabs list box. Inside the tab, you must create at least one group before you can add a command button from the left side of the screen. 
  2. To give the tab a display name, select the New Tab (Custom) item and click the Rename button at the bottom of the Main Tabs list box. Enter your preferred name for the tab in the Rename dialog box and click OK.  
  3. You can use the arrow buttons to the right of the Main Tabs list box to move your then new tab item up or down the list, depending on where you want to place it. 
  4. To create a new custom group , select the tab in which you want to create the group. This could be one of the default tabs, for example, Home , or the new one you’ve created. Click on the New Group button (at the bottom of the screen, under the Main Tabs list box). This will create a new group within the currently selected tab. 
  5. To create a display name for the group, select the New Group (Custom) item and click the Rename button. Enter your preferred name, for example, MyMacros in the Rename dialog box and click OK .
You now have a custom group in which you can add your macro command buttons.
Follow the steps below to add a macro command button to the new custom group:
  1. Select your custom group in the Main Tabs list box. 
  2. Click the Choose commands from drop-down list box (on the left of the dialog box) and select Macros from the drop-down list. In the list box on the left, you’ll see a list of macros created in the current workbook and saved in the PERSONAL.XLSB workbook. 
  3. Select the macro name that you want to add to your custom group in the list box on the left, then click the Add button to add the macro command to the new custom group in the list box on the right.
    Note : If you mistakenly added the wrong command, you can select it in the list box on the right and click the Remove button to remove it.
  4. Click OK on the Excel Options dialog box to confirm the change.
After adding the macro, the name of the macro appears on a button with a generic icon (a program diagram chart). When you click on the button it will run the macro.