Selecting all rows in a listbox via VB code

L

Leighton.d

I have the need to select all rows in a listbox using code attached to a
"Select All" command button. I currently have the code setup to iterate
through all rows and set the .Selected property to True. The listbox
contains roughly 1300 rows, and it takes it several seconds to accomplish the
task.

Is there a "select all" command, so to speak?

Thanks!

Doug
 
O

Ofer

To select all items use this

Dim i As Integer
For i = 0 To ListBoxName.ListCount - 1
ListBoxName.Selected(i) = 1 ' to unselect all items change it to 0
Next i
End Sub
 
Top