Esc Key Macro instead of Ctrl+...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have written a macro that automatically hides the sheet when Ctrl+a is
pressed. However I would like to know if it is possible to write a program
that would allow me to use Esc instead of Ctrl+a.

Thanks
Dajana
 
You can use application.onkey to reassign that key. But remember, it won't do
anything while you're editting a cell.

Option Explicit
Sub testme01A()
Application.OnKey "{Escape}", "Testme01B"
End Sub
Sub testme01B()
MsgBox "you hit escape"
End Sub
Sub testme01C()
Application.OnKey "{Escape}"
End Sub


The top procedure turns it on and the bottom turns it back to normal.
 
Ps. I don't think I'd do this. Escape is used for other things that are too
useful.
 
Back
Top