I have a listbox which has MultiSelect mode on and ListStyleOption on.
How can I make that all the little squares appear selected?
I'd like to use two buttons: Select all and Select none.
Printable View
I have a listbox which has MultiSelect mode on and ListStyleOption on.
How can I make that all the little squares appear selected?
I'd like to use two buttons: Select all and Select none.
removed by poster - failed to get working
removed by poster - failed to get working
removed by poster - failed to get working
@Moderator: can you remove these empty posts? Thank you
I tried using API, cannot get .hwnd of listbox, so...
you *could* loop through the listbox, setting/unsetting the checks!
XL2k7 - the listbox must be an ActiveX listbox and not a form control listbox
XL2k3 - I'll have to check tomorrow! (by :eek2: memory :eek2: , it should be ok) It works XL2k3
Private Sub cmdSelectAll_Click()
'this will select all
Dim nLoopIndex As Integer
For nLoopIndex = 0 To ListBox1.ListCount - 1
ListBox1.Selected(nLoopIndex) = True
Next
End Sub
Private Sub cmdDeselectAll_Click()
'this will deselect all
Dim nLoopIndex As Integer
For nLoopIndex = 0 To ListBox1.ListCount - 1
ListBox1.Selected(nLoopIndex) = False
Next
End Sub