Hi all,
Having a small problem with a worksheet. I've added some code (found on this forum I think) to navigate in & out of a combo box using the Tab key. The path is from E5 -> C6 (which has the combo box on top of it) -> C7:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Allows navigation INTO combo boxes using Tab key
If Not Intersect(Range("C6"), Target) Is Nothing Then
ActiveSheet.ComboBox1.Activate
End If
End Sub
Private Sub ComboBox1_KeyDown(ByVal Keycode As MSForms.ReturnInteger, ByVal shift As Integer)
'Allow navigation OUT using the Tab, Enter, arrow keys
If Keycode = vbKeyUp Or Keycode = vbKeyLeft Or shift = 1 And Keycode = vbKeyTab Then
Range("E5").Activate
ElseIf Keycode = vbKeyTab Or Keycode = vbKeyRight Or Keycode = vbKeyReturn Or Keycode = vbKeyDown Then
Range("C7").Select
End If
End Sub
Problem: selection sticks on C7 for an extra keystroke. ie: if pushing TAB each time it goes like this: E5 -> combobox -> C7 -> C7 -> C8. Strangely, it doesn't stick anywhere when using Shift-Tab to go backwards.
Does anyone know why this happens / how to fix it?
Thanks in advance
Bookmarks