Macros are user created (written or recorded) programs which are used to automate repeated & complex tasks in Excel. Macros feature is available in various Microsoft Office Applications.
Macros can be stored within the Excel file with .xlsm extension. Macros are not allowed to store inside an Excel .xlsx extension file because of security reasons.
Macros are written in VBA (Visual Basic for Applications). VBA (Visual Basic for Applications) is language similar to Microsoft Visual Basic programming language and VB Script language.
To add a Macro to Excel Ribbon, follow these steps.
Step 1 - Right-click anywhere on Excel Ribbon and then select "Customize the Ribbon", as shown in below image.
"Excel Options" window to customize Excel Ribbon will be displayed as shown below.
"Excel Options" window to customize Excel Ribbon can be opened by following methods also.
• Click the "File" tab in Excel Ribbon and then click "Options". Select "Customize Ribbon" Panel.
• Right-click anywhere on the "Quick Access Toolbar" (except on "Customize Quick Access Toolbar" drop-down button). Click "Customize Ribbon".
Step 2 - Click on "Choose Commands from" drop-down list and select "Macros", as shown in below image.
Step 3 - Select the Macro you need to add to Excel Ribbon from left-side list. Select the Group from right-side list where you want to add the Macro (In this example, the selected Group is OmniSecuGroup (Custom)). Click "Add" button to add the Macro to the selected Group. Click "OK" button to finish adding Macro to Ribbon, as shown in below image.
Please note that no Macro will be displayed in left-side list until
1) Atleast a Macro is available (written or recorded) in the Excel workbook you are currently working with
2) A Macro is available in any other Excel workbook which is currently open.
Selected Macro is added to a Group inside a Tab in Excel Ribbon, as shown in below image.
Now you may click the Macro icon from Excel Ribbon to run the Macro. Here in this example, the output of Macro is just a welcome message box, as shown below. In real-time, you may create and add very complex Macros to Excel Ribbon. You can run your favourite macros easily from Excel Ribbon, just by a single click.