Forum Discussion
Up/Down Arrow keys no longer work in ComboBox drop-down list with VBA code - can anyone help?
Am hoping someone can shed some light on what is a small, but annoying problem. I have a searchable combo box with VBA code (not written by myself but culled from various internet sources, mainly stackexchange) in my spreadsheet to enable the user to type part of a word then pick from a list. It used to be possible to move through the list with the up/down arrow keys, but recently this functionality seems to have stopped working and pressing the down key just selects the first item in the list. I'm wondering if it's a setting in Excel or my ComboBox that I've missed, a problem with my code or something else entirely...?
I have attached an example file with the VBA code - and copied the relevant section below.
I have searched this forum and many others in the hope of finding the answer, many people seem to have the same problem, but no-one seems to have a solution.
If anyone can help, I'd be most grateful, it's driving me round the bend!
Thanks in advance, Alison.
Select Case KeyCode
Case 34 'vbKeyPageDown
If ComboBox.ListIndex <> ComboBox.ListCount - 1 Then
ComboBox.ListIndex = ComboBox.ListIndex + 1
Else
ComboBox.ListIndex = 0
End If
Case 33 'vbKeyPageUp
If ComboBox.ListIndex <> 0 Then
ComboBox.ListIndex = ComboBox.ListIndex - 1
Else
ComboBox.ListIndex = ComboBox.ListCount + 1
End If
ActiveCell.Value = Me.ComboBox.Value
ActiveCell.Offset(0, 1).Activate
Case 13 'Enter
ActiveCell.Value = Me.ComboBox.Value
ActiveCell.Offset(0, 1).Activate
Case Else
'do nothing
End Select
End Sub