Executing Sub procedures using a shortcut key
Another very popular way of executing a macro is to press a shortcut key. If you assign that shortcut key when you record a macro, it's quite simple. But what if you entered your code directly in the code window? How do you assign a shortcut key from there?
In this recipe, we are going to assign a shortcut key to a macro and execute it that way.
Getting ready
Excel is still open in the same workbook that we've been working with so far. The VBA Editor is active.
How to do it…
The following steps will show you how to assign a keyboard shortcut to an existing macro:
- In the VBA Editor, choose Developer | Code | Macros.
- The Macro dialog box appears:
- The only available macro is already selected. Click the Options button. The Macro Options dialog box appears:
- Enter a shortcut key in the Ctrl+Shift+ box. For...