#1   Report Post  
Bugsy
 
Posts: n/a
Default Hot Key


Hey
Does anyone know how I can assign a macro be performed when F9 is
clicked ?


--
Bugsy
------------------------------------------------------------------------
Bugsy's Profile: http://www.excelforum.com/member.php...o&userid=24300
View this thread: http://www.excelforum.com/showthread...hreadid=379060

  #2   Report Post  
Earl Kiosterud
 
Posts: n/a
Default

Busgy,

Use the OnKey method. Run this once (perhaps put it in the Workbook_Open
handler or something):

Application.OnKey "{F9}", "MySub"

Now when F9 is pressed, it'll run MySub. Note that this is for any open
workbooks, not just the one that ran the macro. Also, it will remain in
effect when you close the workbook, and if F9 is pressed then, it'll reopen
the workbook containing MySub. You can reset the F9 key with:

Application.OnKey "{F9}", ""

which works nicely in the Workbook_BeforeClose event handler.
--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Bugsy" wrote in
message ...

Hey
Does anyone know how I can assign a macro be performed when F9 is
clicked ?


--
Bugsy
------------------------------------------------------------------------
Bugsy's Profile:
http://www.excelforum.com/member.php...o&userid=24300
View this thread: http://www.excelforum.com/showthread...hreadid=379060



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"