Select All For a Multi Select Box

C

channell

Is there a way to have a toggle button, when clicked, selects all records in
my multi select box? Thanks!!

-Scott Channell
 
W

Wayne-I-M

Hi

Not sure about using a toggle button for this is the best idea but ....

To select all the items in a list box

With Me.ListBoxName
For lngX = Abs(.ColumnHeads) To (.ListCount - 1)
.Selected(lngX) = True
Next
End With

This is normally used to do "something" so you could use

Public Sub SomeButtonName_Click()
Dim varItem As Variant
With Me.ListBoxName
For lngX = Abs(.ColumnHeads) To (.ListCount - 1)
.Selected(lngX) = True
Next
End With
For Each varItem In Me.ListBoxName.ItemsSelected

'add what you want to do in the section - like print reports, etc'

Next varItem
End Sub

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top