ActiveX controls – ListBox in Excel VBA

Building an application for entering data – Inserting a ListBox list box (ActiveX control)

The list box, unlike the combo box, allows us to select more than one selection option at the same time. How do I insert a ListBox list field? As in the case of previous controls, we enter the Developer tab . We choose among ActiveX controlslist box. We place them above the “Contact type” column. The list box in the VBA Editor is very similar to the combo box. The field can also be programmed so that the user can select only one selection option.

 

Building an application for entering data – Programming the ListBox list box (ActiveX control) – single selection

Our table already has a list box. The list field is set by default in a way that only one selection option can be selected. The field programming itself is done in the VBA Editor in the ” Ten_skoroszyt ” object . In our case, we would like to see the values ​​for the contact in the list field: personal, telephone, e-mail. We save it in the following way:

How do I get values ​​from the ListBox VBA list box?

At the moment, we can choose any one value from the list box. To connect the list field with our application for entering data, we proceed in the same way as in the previous chapters. We update the “Arkusz1” object by the following line of code:

 

The code for our program in the Ten_skoroszyt object looks like this:

Leave a comment

Your email address will not be published. Required fields are marked *

%d bloggers like this: