[RESOLVED] Macro option shortcut key fails in Combobox
I have two columns, the A column w/ a combobox populates the B column with info from a named list. There is a macro button with an option shortcut to run it = "Ctrl + F" to print the page. This shortcut function "Ctrl+F" works to print when any of the page is selected except the combobox.
I would like to be able to type in text in that combobox and not have to select another cell before using the "Ctrl+F" function to print. The "Ctrl+F" needs to work while typing selections inside the combobox. Is this possible?
Re: Macro option shortcut key fails in Combobox
try like this, where hhd is the name of the procedure you want to run
vb Code:
Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyF And Shift = 2 Then hhd
End Sub
Re: Macro option shortcut key fails in Combobox
Well, thanks again Pete. I had a little issue but I'm catching on just a bit. Here's another section I had:
Code:
'Private Sub TempCombo_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
'If KeyCode = vbKeyF And Shift = 2 Then PrintARX1
'End Sub
Private Sub TempCombo_KeyDown(ByVal _
KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
If KeyCode = vbKeyF And Shift = 2 Then PrintARX1
If KeyCode = vbKeyR And Shift = 2 Then ClearForm
Select Case KeyCode
Case 9
ActiveCell.Offset(0, 1).Activate
Case 13
ActiveCell.Offset(1, 0).Activate
Case Else
End Select
End Sub
I had another code piece w/ a different name using my combobox, so it didn't work until I inserted the correct portion from yours underneath that. That might seem intuitive to you, but I didn't get it at first. A little rearranging and correct name typing gave me what I needed, and it works for both functions. I'm kinda proud of myself that I figured that part out, even though this must be so basic to most in here!! This must have been much less painful than the last bit of help for me, eh? I have another question related to this but I guess I should start a new thread if I understand the rules right.
Thanks again.