View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Redefining the Ctrl [ and Ctrl ]s short cut with OnKey?

Hi John

Use this
Application.OnKey "^{[}", "FindLinkedCell"



--
Regards Ron de Bruin
http://www.rondebruin.nl



"John Wirt" wrote in message ...
I would like to assign subroutines to two key sequences, default Excel
shortcut key sequences: Ctrl [ and Ctrl ].

Is this possible?

I placed this code in the "ThisWorkbook" module of PERSONAL.xls and got this
error: "Method 'OnKey' object '_Application' failed.

-------
Option Explicit
Private Sub Workbook_Open()
Application.OnKey "^[", "FindLinkedCell"
Application.OnKey "^[", "ReturnToCell"
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnKey "^["
Application.OnKey "^]"
End Sub
---------

The the procedures execute and the keys are rediefined if I use Ctrl a
("^a") and Ctrl b.
John Wirt