Multi-select list box

J

Jim Pockmire

Is there a way to change all items in a listbox to selected or de-selected
via code in one step? i.e. without looping through the ItemsSelected(I)
collection and changing each item to true or false?
 
R

Rick Brandt

Jim said:
Is there a way to change all items in a listbox to selected or
de-selected via code in one step? i.e. without looping through the
ItemsSelected(I) collection and changing each item to true or false?

Without looping? No way I know of. And you wouldn't loop through the
ItemsSelected collection anyway as that would provide no access to rows not
already selected. You would loop using the ListCount value to control the
number of loops and the row being accessed.
 
D

Douglas J. Steele

Deselecting all is easy: simply reset the RowSource or set the Listbox to
Null (the latter doesn't work for MultiSelect = Simple)

Selecting all can't be done without looping.
 
Top