• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Application.OnKey

I'm trying to set up several shortcut keys using the Application.OnKey command in the Workbook.Open event of an Excel 2007 workbook. I'm using the following code, but it is not working. Any suggestions on what I'm doing wrong and how to correct it, would be greatly appreciated.


Application.OnKey "%1", "sNavigateToGroup1"

Application.OnKey "%2", "sNavigateToGroup2"

Application.OnKey "%3", "sNavigateToGroup3"

Application.OnKey "%4", "sNavigateToGroup4"

Application.OnKey "%5", "sNavigateToGroup5"

Application.OnKey "%6", "sNavigateToGroup6"
 
Ken

This is working for me in Excel 2003, and I tried it on the Worksheet_Activate and Worksheet_Open events


With the activate event you will need to change pages after making any changes to the macro

With the open event you will need to save and re-open the spreadsheet after making any changes to the macro


You will also need a subroutine for each of the sNavigateToGroup1..6 names which should be in a normal code module


Strangely in Excel 2010 it doesn't work as Alt 1 seems locked to the save Workbook event

I don't have 2007 to try that out, but watch the status bar and it may show what is happening as it flashes messages past
 
Thanks Hui. Of course, I've been using Excel 2010 for my development and was experiencing the same thing; it doesn't work. Since users could be using either Excel 2003 or 2007, I changed my code to use the CTL key instead of the ALT key. That seems to be less problematic, though I've noticed the shortcut key only works with the numbers at the top of the keyboard, not the numbers on the numpad. Do you know anything about that?


Ken
 
have a read of this post

it should help you I think


http://www.mrexcel.com/forum/showthread.php?t=6239
 
Ken

Have a read of this post, I think it will help you


http://www.mrexcel.com/forum/showthread.php?t=6239
 
Ken

Have a read of this post, which I think will help you


http://www.mrexcel.com/forum/showthread.php?t=6239
 
Ken

Have a read of this post, which I think will help you


http://www.mrexcel.com/forum/showthread.php?t=6239
 
Ken

Have a read of this post, which I think will help you


http://www.mrexcel.com/forum/showthread.php?t=6239
 
Ken

Have a read of this post, which I think will help you


http://www.mrexcel.com/forum/showthread.php?t=6239
 
Back
Top