Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selection all values in a List box by default

Status
Not open for further replies.

Muzzy

Programmer
Dec 14, 2001
68
GB
On the click of a button I need to Select all values in a List box(lstSelected), any ideas how to do this using VBA?
 
Not sure if I understand you, but your listbox has a recordsource you could use this with
me!listBox.recordsetclone this will give the records of the listbox.
 
Unfortunately not very helpful. I have 2 list boxes lstAvailable, lstSelected. I choose items of data from lstAvailable and send it to lstSelected. Now I need to be able to highlight my selections using VBA.
 
Am I right in thinking you just want to select all the items in the list?

In that case:

Dim i as Integer

For i = 0 to lstSelected.ListCount - 1
lstSelected.Selected(i) = True
Next i
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top