Wordle: 1

Monday, 14 April 2014

Ways of running macros

Excel is Fun.

Most users will automatically run a macro from either button on the Quick Access toolbar (known as Toolbars on previous versions) or via the conventional Macrodialog box.

The following is a list of ways to run a macro:

1. The Macro dialog box.
Version 2003 (or earlier) - Click on the Tools menu, select Macro and chooseMacros
Version 2007 (or later) - From the Developer tab, click the Macro icon.

Or the shortcut key to all versions is Alt + F8.

Select the Macro you wish to run and click on the Run button.

2. Using a shortcut key as assigned, i.e. Ctrl + e.

3. From a Button on the worksheet.

4. From an icon Button on the Quick Access toolbar.
Previous versions uses Toolbars.

5. From the Ribbon Bar (though requires some XML knowledge).
Previous versions uses a menu item from the menu bar.

6. From another type of object, e.g. Chart or Graphic image.

7. From a Control drawn on the worksheet, e.g. Combo Box.

8. A worksheet or workbook event, e.g. when a workbook is opened
This is maintained in the Visual Basic Editor (VBE) interface.

The last item is a great way to get Excel to run your code without any user intervention as it's uses Excel's own processes to trigger the macro.

Most users will not be aware that Excel constantly listens for events to happen but do not see any physical results until they learn to manipulate the event handlers provided.

There are many events from a Control (i.e. Button) to opening (Open) and closing (Close) workbooks.

Think about how Data Validation and Conditional Formatting work in Excel worksheets. They respond to when a user has clicked the Enter key (Worksheet_Change) to trigger the two utilities.