Microsoft Office Tutorials and References
In Depth Information
Adding list boxes to UserForms
You can also add a label to identify the control and indicate the data to be entered. To add
a label, display the Toolbox, click the Label button, and drag to define the label in the body
of the form. Position the label so that it’s in line with the text box and then change the
label’s Caption property so that it contains the text required to identify its related control.
TROUBLESHOOTING A control’s name may not be a reserved word, such as Number or Date .
Adding list boxes to UserForms
In a text box, users can enter any text they want into the control. If you prefer to have users
select from a list of values, you can create a list box. List boxes increase data entry accuracy
at the expense of user flexibility.
To create a list box, display a UserForm in the Visual Basic Editor and then, in the Toolbox,
click the ListBox button, and drag on the UserForm to create the list box. When you do, the
list box appears on the UserForm and its properties appear in the Properties panel on the
left side of the Visual Basic Editor window.
A list box control draws its values from a range of worksheet cells. To assign a cell range to
a list box, you enter the range’s definition into the list box’s RowSource property. In Excel
2013, the easiest way to define the row source for a list box is to create a one-column Excel
table.
SEE ALSO For more information about creating an Excel table, see Chapter 2, “Working with
data and Excel tables.”
With your data source defined, enter an equal sign (=) followed by the name of the table in
the RowSource property for your list box. When you run the UserForm, you can use the list
Search JabSto ::




Custom Search