ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Looping through a listbox (https://www.excelbanter.com/excel-programming/425740-looping-through-listbox.html)

EAB1977

Looping through a listbox
 
Simple question...How do I loop through a multi-select single listbox
with 2 columns?

Bernie Deitrick

Looping through a listbox
 
On a userform?

Private Sub CommandButton1_Click()
Dim i As Integer
For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
MsgBox ListBox1.List(i, 0) & " " & ListBox1.List(i, 1)
End If
Next i
End Sub

HTH,
Bernie
MS Excel MVP


"EAB1977" wrote in message
...
Simple question...How do I loop through a multi-select single listbox
with 2 columns?





All times are GMT +1. The time now is 08:07 AM.

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