Public Sub Ventes_Annee()
Dim Tbl(), Bd
derlig = ShV.Range("a" & Rows.Count).End(xlUp).Row
n = 0
Bd = ShV.Range("a2:k" & derlig).Value
With UserForm1
.ListBox4.Clear
For i = 1 To UBound(Bd)
If Bd(i, 1) Like "*" & .ComboBox4 Then
n = n + 1: ReDim Preserve Tbl(1 To UBound(Bd, 2), 1 To n)
For k = 1 To UBound(Bd, 2): Tbl(k, n) = Bd(i, k): Next k
End If
Next i
If n > 0 Then .ListBox4.Column = Tbl
For i = 0 To .ListBox4.ListCount - 1
.ListBox4.List(i, 0) = Format(.ListBox4.List(i, 0), "dd.mm.yyyy")
.ListBox4.List(i, 3) = Format(.ListBox4.List(i, 3), "0.00.-")
Next i
End With
End Sub
Public Sub Ventes_Articles()
Dim Tbl(), Bd, mois1, mois2, an1, an2
derlig = ShV.Range("a" & Rows.Count).End(xlUp).Row
Bd = ShV.Range("a2:f" & derlig).Value
ColList = Array(1, 2, 3, 4)
Ncol = UBound(ColList) + 1
With UserForm1
.ListBox4.Clear
mois1 = Format(.ComboBox8, "mmmm")
an1 = .ComboBox4
n = 0
For i = 1 To UBound(Bd)
mois2 = Format(Bd(i, 1), "mmmm")
an2 = Format(Bd(i, 1), "yyyy")
If mois2 = mois1 And an2 = an1 And Bd(i, 2) = .ComboBox5 Then
n = n + 1: ReDim Preserve Tbl(1 To Ncol, 1 To n)
x = 0
For Each col In ColList
x = x + 1: Tbl(x, n) = Bd(i, col)
Next col
End If
Next i
If n = 0 Then MsgBox "Pas de vente pour cet article.", , "CONTRÔLE VENTES": Exit Sub
.ListBox4.Column = Tbl
For i = 0 To .ListBox4.ListCount - 1
.ListBox4.List(i, 0) = Format(.ListBox4.List(i, 0), "dd.mm.yyyy")
.ListBox4.List(i, 3) = Format(.ListBox4.List(i, 3), "0.00.-")
Next i
End With
End Sub