{"id":12176,"date":"2013-06-09T10:10:38","date_gmt":"2013-06-09T10:10:38","guid":{"rendered":"http:\/\/www.learnexcelmacro.com\/?p=3025"},"modified":"2013-06-09T10:10:38","modified_gmt":"2013-06-09T10:10:38","slug":"assign-hot-key-to-button-in-excel-vba","status":"publish","type":"post","link":"https:\/\/vmlogger.com\/excel\/2013\/06\/assign-hot-key-to-button-in-excel-vba\/","title":{"rendered":"Assign a Hot Key to a Command Button in Excel"},"content":{"rendered":"
In Excel VBA you can assign a hot key for a command Button as well. It means you can assign a hot key to a command button which can be triggered by pressing that hot key from the keyboard. It means you can perform the operation either by clicking on the command button or by pressing the hot key.
\n
\nFor a command button you can assign a hot key by providing the key code in the Accelerator<\/strong> property of the command button. Accelerator property excepts a single key as an input from the keyboard. Hot key for a command button is always a combination of ALT<\/strong> key and the key entered by your choice.
\n
\nNote:<\/strong> Interesting thing about setting a hot key (Accelerator property) for a command button is that you can easily find out the hot key associated for that command button, if your key (letter) exists in the caption of the command button. If key entered by you for a command button exists in the caption of the command button then automatically that letter from the caption get underlined. Refer the below image..
\n <\/p>\n