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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| Option Explicit
Private Sub UserForm_Initialize()
With Me.AffichageSelection
.View = lvwReport
.ColumnHeaders.Add , , "A", 50
.ColumnHeaders.Add , , "C", 50
.ColumnHeaders.Add , , "F", 50
.ColumnHeaders.Add , , "H", 50
.ColumnHeaders.Add , , "J", 50
.ColumnHeaders.Add , , "L", 50
End With
With Me.ComboBox1
.RowSource = "Feuil2!A1:A7"
.ListIndex = 0
End With
With Me.ComboBox2
.RowSource = "Feuil2!B1:B8"
.ListIndex = 0
End With
With Me.ComboBox3
.RowSource = "Feuil2!C1:C9"
.ListIndex = 0
End With
End Sub
Private Sub RemplirLst()
Dim Plage As Range, c As Range
Dim LastLig As Long
Application.ScreenUpdating = False
Me.AffichageSelection.ListItems.Clear
With Worksheets("Feuil1") 'A aadpter
.AutoFilterMode = False
LastLig = .Cells(.Rows.Count, 1).End(xlUp).Row
If LastLig > 11 Then
.Range("F11:J" & LastLig).AutoFilter Field:=1, Criteria1:=IIf(Me.ComboBox1.Value = "All", "*", Me.ComboBox1.Value)
.Range("F11:J" & LastLig).AutoFilter Field:=3, Criteria1:=IIf(Me.ComboBox2.Value = "All", "*", Me.ComboBox2.Value)
.Range("F11:J" & LastLig).AutoFilter Field:=5, Criteria1:=IIf(Me.ComboBox3.Value = "All", "*", Me.ComboBox3.Value)
Set Plage = .Range("A11:A" & LastLig).SpecialCells(xlCellTypeVisible)
If Plage.Count > 1 Then
For Each c In Plage
If c.Row > Plage.Row Then
With Me.AffichageSelection.ListItems.Add(, , c.Value)
.SubItems(1) = c.Offset(, 2)
.SubItems(2) = c.Offset(, 5)
.SubItems(3) = c.Offset(, 7)
.SubItems(4) = c.Offset(, 9)
.SubItems(5) = c.Offset(, 11)
End With
End If
Next c
End If
Set Plage = Nothing
End If
.AutoFilterMode = False
End With
End Sub
Private Sub ComboBox1_Change()
RemplirLst
End Sub
Private Sub ComboBox2_Change()
RemplirLst
End Sub
Private Sub ComboBox3_Change()
RemplirLst
End Sub |
Partager