ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting all items in a Listbox??? (https://www.excelbanter.com/excel-programming/386361-selecting-all-items-listbox.html)

Neily[_3_]

Selecting all items in a Listbox???
 
Hi,

Livvo is asking if I can get a multi-select listbox to select all items in
the box at the click on a button on the form.

Anybody know how to do this?

Ta

Vergel Adriano

Selecting all items in a Listbox???
 
Private Sub CommandButton1_Click()
Dim i as integer
For i = 0 To ListBox1.ListCount - 1
ListBox1.Selected(i) = True
Next i
End Sub


--
Hope that helps.

Vergel Adriano


"Neily" wrote:

Hi,

Livvo is asking if I can get a multi-select listbox to select all items in
the box at the click on a button on the form.

Anybody know how to do this?

Ta


Vergel Adriano

Selecting all items in a Listbox???
 
Private Sub CommandButton1_Click()
Dim i As Integer
For i = 0 To ListBox1.ListCount - 1
ListBox1.Selected(i) = True
Next i
End Sub

--
Hope that helps.

Vergel Adriano


"Neily" wrote:

Hi,

Livvo is asking if I can get a multi-select listbox to select all items in
the box at the click on a button on the form.

Anybody know how to do this?

Ta


Neily[_3_]

Selecting all items in a Listbox???
 
Brilliant, Ta.

"Vergel Adriano" wrote:

Private Sub CommandButton1_Click()
Dim i As Integer
For i = 0 To ListBox1.ListCount - 1
ListBox1.Selected(i) = True
Next i
End Sub

--
Hope that helps.

Vergel Adriano


"Neily" wrote:

Hi,

Livvo is asking if I can get a multi-select listbox to select all items in
the box at the click on a button on the form.

Anybody know how to do this?

Ta



All times are GMT +1. The time now is 11:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com