A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Here is a (rather irritating) example of how to execute code when the user presses the right arrow key. Notice that it replaces the built-in action:
' Code to run
Sub Code4RightArrow()
Beep
End Sub
' Set right arrow key to run Code4RightArrow
Sub AssignRightArrow()
Application.OnKey "{RIGHT}", "Code4RightArrow"
End Sub
' Restore the built-in action of the right arrow key
Sub RestoreRightArrow()
Application.OnKey "{RIGHT}"
End Sub
The "names" of the other arrow keys are {LEFT}, {UP} and {DOWN}.