Bonjour,
après plusieurs essais, j'ai réussi à comptabiliser le nombre de lignes présentes dans ma listbox selon les choix de 3 combobox.
Par contre, le comptage à afficher dans la textbox4 se fait sur la 1e colonne de la listbox. Et je souhaiterais qu'il se fasse sur la 5e colonne, car certaines lignes peuvent ne pas avoir de données en 5e colonne.
Merci pour votre aide.
Laurent.
Private Sub CommandButton1_Click()
With Sheets("Tango logs")
k = 0
Me.ListBox1.Clear
If Me.Textbox3 = "" Then Me.Textbox3 = "*"
If Me.Textbox2 = "" Then Me.Textbox2 = "*"
If Me.Textbox1 = "" Then Me.Textbox1 = "*"
For i = 2 To [A65000].End(xlUp).Row
If Cells(i, 1) Like "*" & Me.Textbox1 & "*" _
And Cells(i, 2) Like Textbox2 And Cells(i, 3) Like Textbox3 Then
Me.ListBox1.AddItem
Me.ListBox1.List(k, 0) = Cells(i, 1)
Me.ListBox1.List(k, 1) = Cells(i, 2)
Me.ListBox1.List(k, 2) = Cells(i, 3)
Me.ListBox1.List(k, 3) = Cells(i, 8)
Me.ListBox1.List(k, 4) = Cells(i, 9)
Me.ListBox1.List(k, 5) = i
k = k + 1
TextBox4 = ListBox1.ListCount 'Partie à modifier je suppose
End If
Next i
End With
End Sub
après plusieurs essais, j'ai réussi à comptabiliser le nombre de lignes présentes dans ma listbox selon les choix de 3 combobox.
Par contre, le comptage à afficher dans la textbox4 se fait sur la 1e colonne de la listbox. Et je souhaiterais qu'il se fasse sur la 5e colonne, car certaines lignes peuvent ne pas avoir de données en 5e colonne.
Merci pour votre aide.
Laurent.
Private Sub CommandButton1_Click()
With Sheets("Tango logs")
k = 0
Me.ListBox1.Clear
If Me.Textbox3 = "" Then Me.Textbox3 = "*"
If Me.Textbox2 = "" Then Me.Textbox2 = "*"
If Me.Textbox1 = "" Then Me.Textbox1 = "*"
For i = 2 To [A65000].End(xlUp).Row
If Cells(i, 1) Like "*" & Me.Textbox1 & "*" _
And Cells(i, 2) Like Textbox2 And Cells(i, 3) Like Textbox3 Then
Me.ListBox1.AddItem
Me.ListBox1.List(k, 0) = Cells(i, 1)
Me.ListBox1.List(k, 1) = Cells(i, 2)
Me.ListBox1.List(k, 2) = Cells(i, 3)
Me.ListBox1.List(k, 3) = Cells(i, 8)
Me.ListBox1.List(k, 4) = Cells(i, 9)
Me.ListBox1.List(k, 5) = i
k = k + 1
TextBox4 = ListBox1.ListCount 'Partie à modifier je suppose
End If
Next i
End With
End Sub