Executing a procedure with a Ctrlshortcut key combination

You can assign a Ctrl+shortcut key combination to any procedure that doesn't use any arguments. If you assign the Ctrl+U key combo to a procedure named Update, for example, pressing Ctrl+U executes the Update procedure.

When you begin recording a macro, the Record Macro dialog box gives you the opportunity to assign a shortcut key. However, you can assign a shortcut key at any time. To assign a Ctrl shortcut key to a procedure (or change a procedure's shortcut key), follow these steps:

1. Activate Excel and choose the Tools ^ Macro ^ Macros command.

2. Select the appropriate procedure from the list box in the Macro dialog box.

3. Click the Options button to display the Macro Options dialog box (see Figure 9-2).

Figure 9-2: The Macro Options dialog box lets you assign a Ctrl key shortcut and an optional description to a procedure.

4. Enter a character into the Ctrl+ text box.

Note: The character that you enter into the Ctrl+ text box is case-sensitive. If you enter a lowercase s, the shortcut key combo is Ctrl+S. If you enter an uppercase S, the shortcut key combo is Ctrl+Shift+S.

5. Enter a description (optional). If you enter a description for a macro, it is displayed at the bottom of the Macro dialog box when the procedure is selected in the list box.

6. Click OK to close the Macro Options dialog box, and then click Close to close the Macro dialog box.

If you assign one of Excel's predefined shortcut key combinations to a procedure, your key assignment takes precedence over the predefined key assignment. For example, Ctrl+S is the Excel predefined shortcut key for saving the active workbook. But if you assign Ctrl+S to a procedure, pressing Ctrl+S no longer saves the active workbook.

The following keyboard keys are not used by Excel for Ctrl+key combinations: E,J,L,M, Q,and T. Excel doesn't use too many Ctrl+Shift+key combinations. In fact, you can safely use any of them except F, O, and P (which are reserved for Find and Replace,Open,and Print, respectively).

Was this article helpful?

0 0

Post a comment