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
| Option Compare Text
Dim TblBD(), dchoisis1, dchoisis2
Private Sub UserForm_Initialize()
TblBD = [client].Value ' pour rapidité
TriMultiCol TblBD, 1, UBound(TblBD), 3
Set d = CreateObject("scripting.dictionary")
For i = 1 To [client].Rows.Count
tmp = TblBD(i, 3): d(tmp) = ""
Next i
Me.OptionsGroupe.MultiSelect = fmMultiSelectMulti
Me.OptionsGroupe.ListStyle = 1 'frmliststyleoption
Tbl = d.keys
Tri Tbl, LBound(Tbl), UBound(Tbl)
Me.OptionsGroupe.List = Tbl
'--
Set d = CreateObject("scripting.dictionary")
For i = 1 To [client].Rows.Count
tmp = TblBD(i, 2): d(tmp) = ""
Next i
Me.OptionsSem.MultiSelect = fmMultiSelectMulti
Me.OptionsSem.ListStyle = 1 'frmliststyleoption
Me.OptionsSem.List = d.keys
'--
Me.ListBox1.ColumnCount = [client].Columns.Count + 1
Me.ListBox1.ColumnWidths = "60;50;30;50;100;70;70;50"
Me.ListBox1.List = TblBD
End Sub
Private Sub OptionsGroupe_change()
Affiche
End Sub
Private Sub OptionsSem_change()
Affiche
End Sub
Sub Affiche()
Set dchoisis1 = CreateObject("Scripting.Dictionary")
For i = 0 To Me.OptionsGroupe.ListCount - 1
If Me.OptionsGroupe.Selected(i) Then dchoisis1(Me.OptionsGroupe.List(i, 0)) = ""
Next i
Set dchoisis2 = CreateObject("Scripting.Dictionary")
For i = 0 To Me.OptionsSem.ListCount - 1
If Me.OptionsSem.Selected(i) Then dchoisis2(Me.OptionsSem.List(i, 0)) = ""
Next i
Dim Tbl2(): n = 0: Ncol = UBound(TblBD, 2)
For i = 1 To UBound(TblBD)
tmp = TblBD(i, 3): tmp2 = TblBD(i, 2)
If dchoisis1.exists(tmp) And dchoisis2.exists(tmp2) Then
n = n + 1: ReDim Preserve Tbl2(1 To Ncol, 1 To n)
For k = 1 To Ncol: Tbl2(k, n) = TblBD(i, k): Next k
End If
Next i
If n > 0 Then Me.ListBox1.Column = Tbl2 Else Me.ListBox1.Clear
End Sub |
Partager