1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| If Sheets("bdd").Range("A1").SpecialCells(xlCellTypeLastCell).Row = 1 Then
MsgBox "Il n'y a aucune donnée à afficher"
Else
With Trouver
With .ColumnHeaders
.Clear
.Add , , "Index", 30
.Add , , "Date", 55
.Add , , "Ligne", 35
.Add , , "Controleur", 40
.Add , , "N°Affaire", 60
.Add , , "N°OF", 70
.Add , , "Etape Contrôle", 65
.Add , , "Origine", 80
.Add , , "Type 1", 70
.Add , , "Type 2", 130
.Add , , "Description du défaut", 200
.Add , , "Impact", 50
.Add , , "TR heures", 60
.Add , , "TR minutes", 60
End With
.Gridlines = True
.FullRowSelect = True
.HideColumnHeaders = False
.LabelEdit = 1
End With
Trouver.ListItems.Clear
'On rempli la listeview appelée "Trouver"
For Each cell In Sheets("bdd").Range("A2", [A65000].End(xlUp)).SpecialCells(xlCellTypeVisible)
Trouver.ListItems.Add.Text = cell.Value
Next cell
i = 1
a = 0
For Each cell In Sheets("bdd").Range("B2", [N65000].End(xlUp)).SpecialCells(xlCellTypeVisible)
If a = 13 Then 'ce a=13 je l'ai trouvé à taton, en fait il faut que lorsqu'on arrive en fin de la première ligne, qu'il remplisse la ligne suivant, d'où ma variable a et l'incrémentation de i qui correspond à la ligne dans la listview
i = i + 1
a = 0
End If
Trouver.ListItems(i).ListSubItems.Add.Text = cell.Value
a = a + 1
Next cell
Trouver.ListItems(1).Selected = False
Set Trouver.SelectedItem = Nothing
End If |