Looping through a listbox

  • Thread starter Thread starter EAB1977
  • Start date Start date
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
 

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

Back
Top