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
| 'Fonction qui recherche les lignes en fonctions des choix des listebox
Private sub FindLine()
'Collection ou seront stocker toutes tes lignes
line as new Collection
'Récupère la derniere ligne de ta colonne la plus rempli
LastRow = WorksheetFunction.Max(Range("A1").End(x1Down).Row,Range("B1").End(x1Down).Row,Range("C1").End(x1Down).Row,Range("D1").End(x1Down).Row)
'Récupère la valeur de tes combo
ladate = USERFORM.COMBO1.value
prix = USERFORM.COMBO2.value
lieu = USERFORM.COMBO3.value
type = USERFORM.COMBO4.value
'Parcour toutes tes cellules des colonnes
For i=0 to LastRow
'test si cela correspond à tes critères
If Range("A" & i) = ladate And Range("B" & i) = prix And Range("C" & i) = lieu And Range("D" & i) = type Then
'Si cela correspond on ajoute la lettre de la ligne dans la collection
line.Add Split(Rows(i).Address(RowAbsolute:=Flase),":")(1) 'JE NE SUIS PAS SUR a 100%
end If
next i
'Pour l'histoire de la photo j'ai pas tout pigé
'Pour balayer tes lignes
for i=1 to line.Count
'Affiche la lettre de la ligne
msgbox line(i)
next i |
Partager