Assigning Shortcuts to Macros using "Alt"

zkest

New Member
Joined
Sep 11, 2007
Messages
2
Hi Everyone,

I am writing some macros for myself, and I would like to create keyboard shortcuts for them. I have third-party add-ins installed that are already using the "control-alt" and "control-shift" combinations, so I wanted to use "alt-shift" (as in "alt-shift-f" - I don't want to use "control-alt-shift" because that's just too cumbersome).

I know how to use the Application.OnKey method to set up shortcuts. If I do the following:

Application.OnKey "%+z", "MacroName"

It works fine - when I press "alt-shift-z", the macro runs. The problem arises when I write:

Application.OnKey "%+f", "MacroName"

When I type "alt-shift-f", the File menu opens! It looks like Excel is ignoring the "shift" and it thinks I want to open the file menu. My macro doesn't get called at all. Can anyone think of a solution? (I do NOT want to disable the menus for this)

Thanks!
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I dont know if this will work for you but what I did when my keyboard could no long accomodatemy macros is I added an item to the Tool Bar labled "Macros" and added a shortcut key to it. "Alt+m" in my case. Once I did that I added all the macros to the new tool bar and set up hot keys for them. Good luck.
 
Upvote 0
Thanks, Mike. That's definitely a possible work-around. The only issue with that approach is if I want to run the same macro twice in a row (if, say, the macro multiplied the current cell by 10, and I wanted to multiply it by 100). In that case, I would have have to press "alt-m-f", then "alt-m-f" again, whereas my ideal solution would be to hold down "alt-shift", and just press "f" twice. I know I'm being very picky (but then again, if i wanted to run the macro 10 times in a row, that could be a serious difference in efficiency), and I'll probably end up using your solution if I can't get exactly what I want.

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,216,052
Messages
6,128,509
Members
449,455
Latest member
jesski

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top