What is the difference between ComboBox and ListBox?

The question here is “what is the difference between combobox and listbox?”

Basically with a combobox you see one selected item at a time, and with a listbox you
can see multiple items, and multiple selected items.

Consider the following 2 examples, where you have a userform with 2 controls displaying the same data listed on a worksheet in the workbook:

Both options show data from the same worksheet. No matter how tall you make the combobox on the left, it is still going to only display 1 item. You normally will only use this box to show 1 item.

Here is the code:

Private Sub UserForm_Initialize()
    LoadBoxes
End Sub


Sub LoadBoxes()
    Dim intCounter As Integer
    
    'load combobox
    With Me.cboSuppliers
        .Clear
        For intCounter = 1 To 132
            .AddItem Sheets("Suppliers").Cells(intCounter, 1).Value
        Next intCounter
    End With
    
    'load listbox
    With Me.lstSuppliers
        .Clear
        For intCounter = 1 To 132
            .AddItem Sheets("Suppliers").Cells(intCounter, 1).Value
        Next intCounter
    End With
End Sub

ComboBox

The ComboBox shows only 1 entry despite the fact that there are multiples.

The ComboBox is usually used when there is only 1 item to select.

ListBox

The ListBox shows every item in the list.

The ListBox is usually used if you want to allow multiple selections or you want to show all the options possible to select.

Watch this:

Let me know if you have any questions.


Posted

in

by

Tags: