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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
| Private Sub CB_Type_Ok_Click()
Dim i, j, k As Integer
Dim Var_T As String
Dim Var_CBB As String
Dim Var_B As Boolean
Dim Var_Vlist As String
Dim Var_Item As String
Dim Var_Vlist2 As String
Dim Var_B2, Var_B3 As Boolean
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim Var_Test1 As String
Dim Var_Test3 As String
Dim Var_Test2 As String
'Filtrage donnée en fonction de la valeur de la liste
Var_T = ComboBox1.Value
Var_B = False
Var_Item = "*"
Var_B2 = False
'If Var_T = "*" Then
'Else
'End If
'Activation recherche fournisseur
ComboBox2.Enabled = True
CB_F_Ok.Enabled = True
ComboBox1.Enabled = False
CB_Type_Ok.Enabled = False
ComboBox2.AddItem Var_Item
Var_Vlist = ComboBox1.List(ComboBox1.ListIndex)
If Var_Vlist = Var_T Then
For i = 2 To 397
Var_CBB = Sheets("BDD Dési").Range("C" & i).Value
Var_Vlist2 = Sheets("BDD Dési").Range("B" & i).Value
'Test pour savoir si la ligne correspond bien à la sélection type
If Var_Vlist2 = Var_Vlist Then
For j = 0 To ComboBox2.ListCount - 1
ComboBox2.ListIndex = j
If ComboBox2.Value = Var_CBB Then
Var_B2 = True
Else
Var_B2 = False
End If
Next j
If Var_B2 = False Then
ComboBox2.AddItem Var_CBB
Else
End If
Else
End If
Next i
' test de présence doublon
For a = 0 To ComboBox2.ListCount
ComboBox2.ListIndex = a
Var_Test1 = ComboBox2.Value
c = a + 1
If c >= ComboBox2.ListCount Then
Exit Sub
Else
End If
ComboBox2.ListIndex = c
Var_Test3 = ComboBox2.Value
If Var_Test1 = Var_Test3 Then
Var_B3 = True
Else: Var_B3 = False
End If
If Var_B3 = False Then
For b = 0 To ComboBox2.ListCount - 1
If b > ComboBox2.ListCount - 1 Then
Exit For
Else: End If
ComboBox2.ListIndex = b
Var_Test2 = ComboBox2.Value
If Var_Test1 = Var_Test2 Then
ComboBox2.List.RemoveItem b
Else
End If
Next b
Else
End If
Next a
Else
End If
End Sub |
Partager