ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel VBA - keypress code (https://www.excelbanter.com/excel-programming/304917-excel-vba-keypress-code.html)

bforster1[_7_]

excel VBA - keypress code
 
Can someone provide code to have an event trigger whenever a key i
pressed??

I am a newbie so details would be appreciated.

Thanks

--
Message posted from http://www.ExcelForum.com


John Green[_4_]

excel VBA - keypress code
 
Use Application.OnKey to assign macros to keys. The following assigns a
procedure called InsertCol to the lower case a key:

Application.OnKey "a", "InsertCol"

You can also use key combinations such as "^a" for Ctrl+a. Look at OnKey in
help to get a comprehensive list of key combinations that can be used.

John Green




"bforster1 " wrote in message
...
Can someone provide code to have an event trigger whenever a key is
pressed??

I am a newbie so details would be appreciated.

Thanks.


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 05:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com