Option Explicit
Dim n As Byte, k As Byte, x As Byte, derlig As Long, i As Long, ColDate
Private Sub UserForm_Initialize()
Call Init_Valeurs
n = Sheets("Factures").Range("A:G").Columns.Count
ListBox1.ColumnCount = Sheets("Factures").Range("A:G").Columns.Count
ListBox1.ColumnWidths = "50;90;80;70;70;70;60"
For k = 1 To n
With Sheets("Factures")
Me("Label" & k) = .Cells(1, k).Text
End With
Me("Label" & k).Top = Me("Label" & k).Top + 5
Next
With Sheets("Factures")
derlig = .Range("a" & Rows.Count).End(xlUp).Row
For i = 1 To 7
ComboBox1.AddItem Rech_Comb(i)
Next i
For x = 2 To derlig
ListBox1.AddItem .Range("a" & x)
For j = 2 To 7
ListBox1.List(ListBox1.ListCount - 1, j - 1) = .Cells(x, j)
ColDate = ListBox1.List(ListBox1.ListCount - 1, j - 1)
If IsDate(ColDate) Then _
ListBox1.List(ListBox1.ListCount - 1, j - 1) = Format(ColDate, "dd.mm.yyyy")
Next j
Next x
End With
End Sub
Private Sub UserForm_Activate()
ComboBox1 = ""
End Sub
Private Sub ComboBox1_Change()
If ComboBox1 <> "" Then
Call Recherche
Else
End If
End Sub
Private Sub Recherche()
If ComboBox1 = Rech_Comb(1) Then ListBox1.RowSource = Rech_List(1): Exit Sub
If ComboBox1 = Rech_Comb(2) Then ListBox1.RowSource = Rech_List(2): Exit Sub
If ComboBox1 = Rech_Comb(3) Then ListBox1.RowSource = Rech_List(3): Exit Sub
If ComboBox1 = Rech_Comb(4) Then ListBox1.RowSource = Rech_List(4): Exit Sub
If ComboBox1 = Rech_Comb(5) Then ListBox1.RowSource = Rech_List(5): Exit Sub
If ComboBox1 = Rech_Comb(6) Then ListBox1.RowSource = Rech_List(6): Exit Sub
If ComboBox1 = Rech_Comb(7) Then ListBox1.RowSource = Rech_List(7): Exit Sub
End Sub