• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Creating a keyboard shortcut on a new user form

BobBridges

Active Member
I'm relatively new to userforms in Excel. I've got two forms working, but now I'm thinking about creating keyboard shortcuts in them. I don't see how, though.

In an old Access database I wrote years ago, I just had to include an ampersand in the Caption property and that took care of it. For instance, on a command button labeled "Child", I could make the Caption property "Chil&d"; on the button it would be displayed as "Child" (the 'd' underlined), and the operator could hit <Alt-d> to simulate pushing that button.

In the Excel form, though, I have a radio button; if I render its caption as "&All reports", it's just displayed with the ampersand. How do I do this in Excel user forms?
 
Thanks for playing, Logit, but, sorry, you have to actually read the question. I know how to create a keyboard shortcut that triggers the start of a VBA program; what I don't know how to do is a keyboard shortcut that moves the focus to a particular field in a user form. I can do it in Access, but apparently Excel does it differently.
 
Hi Bob
It is the same in Excel.
Use the accelerator property
see example. (shortcut for OptionButton2)
The shortcut is Alt + q
 

Attachments

  • sample bob.xlsm
    13.4 KB · Views: 5
Ah, the Accelerator property; I didn't see that before. Well, it's definitely not the same as Access, or at least as Access used to be a couple decades ago. But it seems to be what I want. I'll try it out, thanks.
 
Hi Bob,
Glad to help.
Let me know if your problem is solved.
What I meant by: it is the same in Excel, you just have to enter a letter just like in Access
 
Back
Top