Run a macro

Run a macro

There are several ways to run a macro in Microsoft Excel. A macro is an action or a set of actions that you can use to automate tasks. Macros are recorded in the Visual Basic for Applications programming language. You can always run a macro by clicking the Macros command on the ribbon. Depending on how a macro is assigned to run, you might also be able to run it by pressing a CTRL combination shortcut key, by clicking a button on the Quick Access Toolbar or in a custom group on the ribbon. or by clicking an area on an object, graphic, or control. In addition, you can run a macro automatically when you open a workbook.
NOTE: When you set the macro security level in Excel to Disable all macros without notification, Excel will run only those macros that are digitally signed or stored in a trusted location, such as the Excel startup folder on your computer. If the macro that you want to run is not digitally signed or located in a trusted location, you can temporarily change the security level that enables all macros.

Before you run macros

You need to change a few settings in Excel before you can run macros:
  1. If the Developer tab is not available, display it. For more information, see Show the Developer tab.
  2. To set the security level temporarily to enable all macros, do the following:
    1. On the Developer tab, in the Code group, click Macro Security.
      Developer tab on the ribbon
    2. In the Macro Settings category, under Macro Settings, click Enable all macros (not recommended; potentially dangerous code can run), and then click OK.
      NOTE: To help prevent potentially dangerous code from running, we recommend that you return to any one of the settings that disable all macros after you finish working with macros.

Need more help?

You can always ask an expert in the Excel Tech Community, get support in the Answers community, or suggest a new feature or improvement on Excel User Voice

Comments