Forum Discussion
What keyboard shortcuts are assigned?
StewDay , I'm sure there's a way to find out programmatically but that's beyond what I can do. Quick web search showed a few results so maybe there's a solution already out there. Here's a couple that looked promising:
https://answers.microsoft.com/en-us/msoffice/forum/all/how-do-i-find-out-what-keys-my-macros-have-been/8c773826-9242-e011-9767-d8d385dcbb12
https://www.excelforum.com/excel-programming-vba-macros/1252748-how-do-i-find-out-what-macro-a-particular-keyboard-shortcut-is-assigned-to.html
Thanks TheAntony.
That put me on the trail to something useful ... https://stackoverflow.com/questions/16862306/excel-vba-to-list-key-bindings-onkey
Still didn't allow me to see ALL keyboard shortcuts ... looks like those like Ctrl+x are called OnKey bindings and I didn't work out how to see them.
But there was a reference to using [Add Watch] , a right-click function in the VBA editor to stop any code from executing. After setting that up and using the shortcut Ctrl+Shift+Q I was able to see it was actually assigned to an old macro that had been commented out. So it was running, but there was nothing to run.
I've now re-assigned it to the preferred macro and it's working as expected.
So now if I want to assign a new kb shortcut to a macro I first have to check it's not already used by Excel by referring to a list like this one https://support.microsoft.com/en-us/office/keyboard-shortcuts-in-excel-1798d9d5-842a-42b8-9c99-9b7213f0040f then turn on [Add Watch] to check it's not already assigned to one of my macros!
Thanks for making things straight forward Microsoft!