Setup "hotkey" for macros in Excel

As I wrote in the last post, we can setup "hotkeys" for some macros (VBA Sub or Function) in Excel. It avoids the needs to create buttons or setup events in objects just to trigger those. It also brings the "actions" to other Excel files you have also opened.

It's in the Macro execution option. Note that you can only see "Public Sub/Function" there.
【中文】
如上篇所提,可以在Excel中指定快速鍵給自訂的巨集(VBA的Sub或Function)。這省去為了讓使用者可以不進入巨集撰寫介面而能觸發它,且不需特別拉一個按鈕或指定物件的事件。同樣的,它可以讓其他同時開啟的Excel檔案使用這些功能。
簡單的在巨集的畫面指定它的選項即可。

(1) This file has three subs, and one is private. Goto "Tools" > "Macro" > "Macro" / 這檔案有三個子程式,其中一個是私有的。由「工具」>「巨集」>「巨集」

(2) In the control window, you may only see two subs without the private sub. Choose the macro you want to apply and click "Option" / 在對話視窗中,可以發現僅看得到兩個非Private的子程式。選擇要執行的巨集後,點選「選項」。

(3) In the option dialog, you can see the hotkey option. Just hit the key you wanna apply (only one char/key, but you may combine with "Shift"), and click "OK" / 在對話視窗中,可以看到快速鍵選項,只要在那邊輸入你想要使用的按鈕(僅可一個,但可以與"Shift"鍵結合使用),然後點選確認。

It's done. Then you may use hotkey (in this example, press Ctrl+Shift+E) to execute the function (PubSub_01). / 這樣即完成,然後你可用快速鍵執行指定的功能。

留言

這個網誌中的熱門文章

Excel技巧(1):檔案肥大的原因,附上減肥撇步

Excel技巧(2):拜託殺了那些看不見的空白吧!