Excel error while trying to autocomplete ActiveX ComboBox

I have an ActiveX Combobox control in a worksheet and this is the _Change event _Change

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

When I use the keyboard up / down to move through the list, it automatically closes Excel.

Does anyone know a solution to this problem? I basically want a dynamic ComboBox.

+7
vba excel-vba excel
source share
1 answer

You force the Combobox values ​​to change when the selected parameter changes,
that’s why it collapses.

You can try to save Me.ComboBox1.DropDown in this case.

But .ListFillRange should be in another case:

  • Workbook_Open
  • Workbook_SheetChange
  • Worksheet_SelectionChange
  • Worksheet_Change

If you are trying to create some sort of autocomplete behavior , you can use the built-in property :

  • Right-click on the Control, select Properties
  • In the properties window that opens, find the MatchEntry property
  • Set value 0 - fmMatchEntryFirstLetter
+3
source share

All Articles