Running Macros - Keyboard
- 02:11
Understand how to assign a keyboard shortcut to Macros
Downloads
No associated resources to download.
Glossary
Record a Macro VBATranscript
Okay, so let's have a look at how we assign a keyboard shortcut to run a macro. We can do this when we record the macro. So when we record the macro by any method we like, we give it a name and in the shortcut key here, this is where we can go and assign a keyboard shortcut. You'll also see the same dialog box when we go into the options for macros that we've already recorded. So if we go to alt F8 to bring up our macros dialogue box, we choose the macro that we'd like to assign a keyboard shortcut to. So in this case, I'm gonna choose the enter my name macro, click on options, and then we'll see any keyboard shortcut that's currently assigned, or in this case there is no keyboard shortcut currently assigned.
So you'll see it says control and, obviously I need to type a letter in here so I could type H or any other letter. It's worth knowing that when we assign a keyboard shortcut to a macro in this way, it's gonna overwrite any existing keyboard shortcut when this macro is available. So you need to be a little bit careful that you don't overwrite other shortcuts that you know you'll be making use of. One way to do this is to, instead of doing control and a letter, what we can do is if you hold down the shift key and choose the letter we'd like to assign, so let's say I wanted E for enter my name, just the shift key and E changes the shortcut key that's gonna be assigned to control and shift and the letter I just chose. So obviously, although these might also overwrite shortcuts that exist already, they're usually the ones that are less commonly used. If I click OK and then just cancel out of that dialog box, if I want to go and remove a shortcut then it's the same process. It's ALT F8, choose the macro where I know there's a shortcut currently assigned, go to options. And then all I need to do is just delete the letter, click OK, and then cancel out the dialog box.