Microsoft Office Tutorials and References
In Depth Information
ListBox Techniques
range. The items appear in the ListBox at design time as soon as you specify the range for the
RowSource property.
Figure 14-8: Setting the RowSource property at design time.
In most cases, you’ll want to include the worksheet name when you specify the
RowSource property; otherwise, the ListBox will use the specified range on the active
worksheet. In some cases, you may need to fully qualify the range by including the
workbook name. For example:
[budget.xlsx]Sheet1!A1:A12
A better practice is to define a name for the range and use that name in your code. This
habit will ensure that the proper range is used even if rows above the range are added
or deleted.
Adding items to a ListBox at runtime
To add ListBox items at runtime, you have two choices:
h Set the RowSource property to a range address by using code.
h Write code that uses the AddItem method to add the ListBox items.
 
Search JabSto ::




Custom Search