Forum Discussion

Anggie's avatar
Anggie
Copper Contributor
Sep 04, 2019

VBA Drop Down List

Hi Everyone,
I developed a combo box drop down list and added a code that works fine but doesn’t let me scroll down my listed options using my down arrow keyboard button. Is there a code to use the down arrow and enter button on the drop down list.

Here is the code I’m currently using:

Private Sub ComboBox1_Change()
ComboBox1.ListFillRange = "DropDownListv1"
Me.ComboBox1.DropDown
End Sub

Hope anyone can help me!

15 Replies

  • JKPieterse's avatar
    JKPieterse
    Silver Contributor
    I expect changing the listfillrange causes the listindex to be reset, hence you cannot go through the items iwith the keyboard as the list keeps changing?
    • Anggie's avatar
      Anggie
      Copper Contributor
      I’m not changing the list range. The issue is when I click on the combo box and try to scroll down it crashes.
      • Subodh_Tiwari_sktneer's avatar
        Subodh_Tiwari_sktneer
        Silver Contributor

        Anggie 

        You can set the ListFillRange utilizing an event called GotFocus so that it doesn't set the ListFillRange each time you type in the ComboBox.

         

        Private Sub ComboBox1_GotFocus()
        ComboBox1.ListFillRange = "DropDownListv1"
        End Sub

         

Resources