How to use and configure ActiveX list box control property in VBA Excel

Who I am
Pavel Yosifovich
@pavelyosifovich
Author and references

When we get used to working with certain ActiveX controls, we will realize that their use and configuration are performed almost identically. And we will focus only on specifying its elements. This allows us to simplify some steps, but in general it is very easy to use the list box in VBA.

As always, we refer you to another article that illustrates the use of the functions of this application. As knowledge of this application guarantees us success and therefore it is good to know how to use ActiveX scroll bar in Excel to scroll a table.



How to use and configure ActiveX list box control property in VBA Excel

To  use and configure ActiveX list box control property in VBA Excel, we need to draw a list box first. To do this and we can insert a list box, in the Excel spreadsheet. We need to go to the top menu, in it we will select the Programmer tab and when the options appear, we create a clip on Insert.

And then we will select the List Box option in the ActiveX Controls section, now we will configure the properties of this box. To do this, let's go back to  Programmer card, then in the group we will choose Controls and finally we create a clip on properties.

In this window we will call the property ListFillRange, in it we will indicate in which cell ranges are those that will contain the elements of said list box. For example we can place the ranges B1: B5, it is where the values ​​will be taken. This means that the list box will take its values ​​in that range.

Use code to use and set ActiveX list box control property in VBA Excel

But one of the most common ways used to indicate the items that a list box will contain is through a VBA code. And continuing with the previous example, we can write the following code in Workbook_Open:



Private Work Subfolder_Open ()

      With Sheet. ListBox1

              .AddItem "Monday"

              .AddItem "Tuesday"

              .AddItem "Wednesday"

              .AddItem "Thursday"

              .AddItem "Friday"

              .AddItem "Saturday"

       Ends with

End subtitle

And then when the book is opened, all the options will be added to the list box which was named ListBox1. We can also bind any cell to the list box. To improve this in the properties window we will select the property LinkedCell and there we must specify which cell we will associate with the list box.


In this way, whenever a selection is made in any option in the list box, its value will be reflected in the cell we have associated. In this simple and easy way we can use and configure the ActiveX list box control property in VBA Excel. And this without prior knowledge of coding, programming or something like that.


This brings us to the end of another article, which seeks to expand your knowledge on different functions which can be run with ActiveX.

Only constant practice will allow you to be an expert in making projects with the Excel spreadsheet and now you know how to use and configure ActiveX list box control property in VBA Excel.

Audio Video How to use and configure ActiveX list box control property in VBA Excel
add a comment of How to use and configure ActiveX list box control property in VBA Excel
Comment sent successfully! We will review it in the next few hours.