Bonjour, 
j'ai un soucis que je n'arrive pas a résoudre ...
je fait un filtre avec une listbox sur plusieurs feuilles de mon classeur excel , mais j'ai cette erreur que je n'arrive pas a enlever ... Il me dit "l'indice n'appartien pas a la selection."
voici le code :
	
	
	
	
	
		
<config>Windows 7 / Internet Explorer 8.0</config>
	
		
			
		
		
	
				
			j'ai un soucis que je n'arrive pas a résoudre ...
je fait un filtre avec une listbox sur plusieurs feuilles de mon classeur excel , mais j'ai cette erreur que je n'arrive pas a enlever ... Il me dit "l'indice n'appartien pas a la selection."
voici le code :
		Code:
	
	
	Option Explicit
Dim v(10000, 6) As String
Dim nbV As Long
Private Sub CommandButton2_Click()
Me.Hide
End Sub
Private Sub Label5_Click()
End Sub
Private Sub ListView1_DblClick()
    Dim indice As Long
    indice = ListView1.SelectedItem.Tag
    With ThisWorkbook.Sheets(v(indice, 0))
    .Select
    .Range("B" & CLng(v(indice, 6)) & ":G" & CLng(v(indice, 6))).Select
    End With
End Sub
Private Sub TextBox1_Change()
AfficherVecteur
End Sub
Private Sub TextBox2_Change()
AfficherVecteur
End Sub
Private Sub TextBox3_Change()
AfficherVecteur
End Sub
Private Sub TextBox4_Change()
AfficherVecteur
End Sub
Private Sub TextBox5_Change()
AfficherVecteur
End Sub
Private Sub TextBox6_Change()
AfficherVecteur
End Sub
Private Sub UserForm_Initialize()
Dim f As Worksheet
Dim i As Long
Dim r As Range
nbV = 0
For Each f In ThisWorkbook.Worksheets
    Set r = f.Range("B16")
    
    If f.Name <> "Accueil" Then
        For i = 2 To f.Range("B65536").End(xlUp).Row
            nbV = nbV + 1
            v(nbV, 0) = Trim(r.Offset(i - 1, 0))
            v(nbV, 1) = Trim(r.Offset(i - 1, 1))
            v(nbV, 2) = Trim(r.Offset(i - 1, 2))
            v(nbV, 3) = Trim(r.Offset(i - 1, 3))
            v(nbV, 4) = Trim(r.Offset(i - 1, 4))
            v(nbV, 5) = Trim(r.Offset(i - 1, 5))
            v(nbV, 6) = i
        Next i
    End If
Next
AfficherVecteur
End Sub
Function AfficherVecteur()
ListView1.ListItems.Clear
Dim i As Long
For i = 0 To nbV
    If Valide(i) Then AjoutListe i
Next i
End Function
Function Valide(i) As Boolean
Valide = ((v(i, 0) = TextBox1 Or TextBox1 = "") And _
(v(i, 1) = TextBox2 Or TextBox2 = "") And _
(v(i, 2) = TextBox3 Or TextBox3 = "") And _
(v(i, 3) = TextBox4 Or TextBox4 = "") And _
(v(i, 4) = TextBox5 Or TextBox5 = "") And _
(v(i, 5) = TextBox6 Or TextBox6 = ""))
End Function
Function AjoutListe(i)
    Dim j As Long
    With ListView1
    .ListItems.Add , , v(i, 0)
    For j = 1 To 5
        .ListItems.Item(.ListItems.Count).ListSubItems.Add , , v(i, j)
    Next j
    .ListItems.Item(.ListItems.Count).Tag = i
    End With
End Function
	<config>Windows 7 / Internet Explorer 8.0</config>
			
				Dernière édition: