Selecting all entries in a list-box

  • Thread starter Thread starter Jonathan Blitz
  • Start date Start date
J

Jonathan Blitz

How can I select/unselect all the entries in a listbox from with VBA code.

I am trying to create select/unselect all buttons.

--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
 
Jonathan,

You will need to loop through all the items in your
listbox and select or unselect them. See below, this
will select the items in your listbox. To Unselect them,
change True to False. Set the OnClick event to a Command
Button on your form.

Dim intctr As Integer
With Forms!MyForm!MyListBox
For intctr = 0 To .ListCount - 1
.Selected(intctr) = True
Next intctr
End With

Regards,

Xcelsoft
 
Back
Top