Unassign Macro Keyboard Shortcut?

D

Dave Birley

Not a show stopper, but when I am developing a complex Macro, I will often
record little slices of code and accept the default Macro name (Macro1,
Macro2... etc.), then to test it I may assign a keyboard shortcut to it so I
can give it a shot on several WS. Later I may want to re-use the shortcut
without deleting the original Macro. In other words I need to "unassign" the
shortcut to Macro[n], and assign it to Macro[n+x]. It's the old "quick and
dirty" game.

However when I use what seems logical, namely the Delete key, I get a
nasty-gram telling me that the shortcut meeds to be an alpha character.

That being said -- I have a hunch there is a way (the Help files being as
unhelpful as usual <g>).
 
V

Vergel Adriano

Dave,

Search the VBA help for the "OnKey" method. For example, if you have a
macro assigned to the shortcut CTRL+1, you can use this to clear it

Application.OnKey "^1"

you can just type it in the Immediate window of the VBE and hit Enter.
 
D

Dave Birley

I KNEW there must be a way <g>!
--
Dave
Temping with Staffmark
in Rock Hill, SC


Vergel Adriano said:
Dave,

Search the VBA help for the "OnKey" method. For example, if you have a
macro assigned to the shortcut CTRL+1, you can use this to clear it

Application.OnKey "^1"

you can just type it in the Immediate window of the VBE and hit Enter.


--
Hope that helps.

Vergel Adriano


Dave Birley said:
Not a show stopper, but when I am developing a complex Macro, I will often
record little slices of code and accept the default Macro name (Macro1,
Macro2... etc.), then to test it I may assign a keyboard shortcut to it so I
can give it a shot on several WS. Later I may want to re-use the shortcut
without deleting the original Macro. In other words I need to "unassign" the
shortcut to Macro[n], and assign it to Macro[n+x]. It's the old "quick and
dirty" game.

However when I use what seems logical, namely the Delete key, I get a
nasty-gram telling me that the shortcut meeds to be an alpha character.

That being said -- I have a hunch there is a way (the Help files being as
unhelpful as usual <g>).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top