richardcarter
Board Regular
- Joined
- Dec 10, 2003
- Messages
- 77
I'm trying to create a keyboard shortcut which will run a macro which will move the cursor to a specific textbox in a userform.
This is the macro I have to move the cursor:
Private Sub Cursor_to_textbox1()
textbox1.SetFocus
End Sub
Because the above macro is a 'Private Sub' macro, I cannot create a normal keyboard shortcut, so I understand from other posts that I need to use the following to create the shortcut (which is placed in the 'This Workbook' module):
Private Sub Workbook_Test()
Application.OnKey "+Q", "textbox1"
End Sub
However, the above code doesn't seem to work correctly because when I press SHIFT+Q when the userform is open, all it does is place the letter 'Q' in the textbox which the cursor is currently in.
Any ideas?
This is the macro I have to move the cursor:
Private Sub Cursor_to_textbox1()
textbox1.SetFocus
End Sub
Because the above macro is a 'Private Sub' macro, I cannot create a normal keyboard shortcut, so I understand from other posts that I need to use the following to create the shortcut (which is placed in the 'This Workbook' module):
Private Sub Workbook_Test()
Application.OnKey "+Q", "textbox1"
End Sub
However, the above code doesn't seem to work correctly because when I press SHIFT+Q when the userform is open, all it does is place the letter 'Q' in the textbox which the cursor is currently in.
Any ideas?