Create a List

In Microsoft Excel 2003, lists are ranges of cells that can easily be sorted, filtered, or shared. Lists are a little different from the AutoFilter feature available in earlier versions of Excel in that lists are treated as a single entity, rather than just a range of cells. This unity is illustrated by a blue border that Excel draws around the cells in a list (Figure 2-22).

There are other nice-to-have advantages to lists over AutoFilter ranges:

  • Lists automatically add column headers to the range.

  • Lists display a handy List Toolbar when selected.

  • It is easy to total the items in a list by clicking the Toggle Total button.

  • XML data can be imported directly into a list.

    A list (left) and an AutoFilter range (right)

    Figure 2-22. A list (left) and an AutoFilter range (right)

  • Excel can automatically check the data type of list entries as they are made.

  • Lists can be shared and synchronized with teammates via Microsoft SharePoint Services.

That last item is the key advantage of lists—really, lists are just a way to share information that fits into columns and rows.

How to do it

To create a list from Excel, select a range of cells and then choose Data List Create List. Excel converts the selected range into a list and displays the Lists toolbar (shown in Figure 2-22).

To create a list from code, use the Add method of the ListObjects collection. The ListObjects collection is exposed as a property ...

Get Excel 2003 Programming: A Developer's Notebook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.