ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Esc Key Macro instead of Ctrl+... (https://www.excelbanter.com/excel-discussion-misc-queries/57816-esc-key-macro-instead-ctrl.html)

Dajana

Esc Key Macro instead of Ctrl+...
 
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

Dave Peterson

Esc Key Macro instead of Ctrl+...
 
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.

Dajana wrote:

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


--

Dave Peterson

Dave Peterson

Esc Key Macro instead of Ctrl+...
 
Ps. I don't think I'd do this. Escape is used for other things that are too
useful.

Dajana wrote:

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


--

Dave Peterson


All times are GMT +1. The time now is 12:37 AM.

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