
The ComboBox is a drop-down list (the user-entered item or the list-selected item is visible in the text area, whereas list values are visible by using the drop-down), while a ListBox shows a certain number of values with or without a scroll bar. They facilitate in accepting data from users and making entries in an Excel worksheet.ġ. Using ActiveX Controls on a Worksheet have been illustrated in detail, in the separate section of " Excel VBA: ActiveX Controls, Form Controls & AutoShapes on a Worksheet".Īn Excel VBA ListBox or ComboBox is a list of items from which a user can select. By itself, a UserForm will not be of much use unless ActiveX controls are added to it which are the actual user-interactive objects. UserForm acts as a container in which you add multiple ActiveX controls, each of which has a specific use and associated properties. To change the caption of the Userform and command button, click View, Properties Window and click on each control.ĥ.Add Items/Data to (Populate) a ListBox or ComboBoxĮxtract ListBox & ComboBox Items, with VBAĭelete ListBox rows using the RemoveItem Method It is good practice to change the names of the controls, but it is not necessary here because we only have a few controls in this example. Captions are those that appear on your screen. You can change the names and the captions of the controls.

Next, you can drag a combo box on the Userform.Ĥ. For example, create a combo box control by clicking on ComboBox from the Toolbox. Once this has been completed, the result should be consistent with the picture of the Userform shown earlier. Add the combo boxes (first at the left, the second at the right) and command button. If the Toolbox does not appear automatically, click View, Toolbox. If the Project Explorer is not visible, click View, Project Explorer.Ģ.


To create this Userform, execute the following steps.ġ.

As a result, the user can select a sport from a second drop-down list. The user selects Sports from a drop-down list.
