How do you use ListBox in Excel?

What is ListBox control?

The list box allows you to see multiple items in one view and
allows the user to select one or multiple items in the list.

It helps you to manage a big worksheet, and allows you to put constraints on
your data lists.

You can design it with the ability to select one item, or multiple item.
IMO, if you are only going to allow selecting 1 item, why not just use a ComboBox?

IMO, a ListBox’s purpose is to allow selecting multiple items

Here is a ListBox with the multiselect option selected:

How do I use listbox in VBA?

Here I am using a ListBox to display the values in column A of my worksheet:

I am loading the UserForm with a command button

The button is called “btnOpenForm”, and I am programming the click event:

BTW, here is the code for adding the items from your sheet to your ListBox:

{if you can’t interact with your new button, like click on it, make sure you’re out of “Design Mode”)

Make the setting on your listbox in the “MultiSelect” property: frmMultiSelectExtended (frmMultiSelectMulti allows you to select without the Shift or Ctrl keys, IMO, it’s not normal for users so don’t use it)

To select multiple items from your new ListBox, hold down the “CTRL” key while you left click. With consecutive items, hold down the “Shift” key.

Then show the items you just selected by clicking on “Display Selected Items”:

Here is the code to loop through the selected items:

Now you can use the selected ListBox items, and write them to other cells, or other places on your worksheet.

Let me know if you have any questions.

Please remember to subscribe to my youtube channel

Been helped? Get these!

Facebooktwittergoogle_plusredditpinterestlinkedinmail