Private Sub correspondance_Enter()
Call tri_combo_2
End Sub
Private Sub equivalence_Enter()
Call tri_combo_3
End Sub
Private Sub Number_Change()
Maligne = Sheets("Sheet1").Range("A3000").End(xlUp).Row + 1
Sheets("Sheet1").Range("A" & Maligne) = Me.number
End Sub
Private Sub UserForm_Initialize()
Call tri_combo_1
End Sub
Sub tri_combo_1()
Application.ScreenUpdating = False
With Sheets("Sheet1")
drligne = .[A:B].Find("*", , , , 1, 2).Row
Set dico = CreateObject("Scripting.Dictionary")
For Each c In .Range("a2:a" & drligne)
If Not dico.exists(c.Value) And c.Value <> "" Then dico.Add c.Value, c.Value
Next c
End With
a = dico.Keys
With UserForm1
For K = 0 To dico.Count - 1
.number.AddItem a(K)
Next
End With
Application.ScreenUpdating = True
End Sub
Sub tri_combo_2()
UserForm1.correspondance.Clear
With Sheets("Sheet1")
drligne = .[A:C].Find("*", , , , 1, 2).Row
Set dico = CreateObject("Scripting.Dictionary")
For Each c In .Range("C2:C" & drligne)
If Sheets("Sheet1").Cells(c.Row, "A").Text = UserForm1.number.Text Then
If Not dico.exists(c.Value) And c.Value <> "" Then dico.Add c.Value, c.Value
End If
Next c
End With
a = dico.Keys
With UserForm1
For K = 0 To dico.Count - 1
.correspondance.AddItem a(K)
Next
End With
Set dico = Nothing
End Sub
Sub tri_combo_3()
UserForm1.equivalence.Clear
With Sheets("Sheet1")
drligne = .[A:C].Find("*", , , , 1, 2).Row
Set dico = CreateObject("Scripting.Dictionary")
For Each c In .Range("B2:B" & drligne)
If Sheets("Sheet1").Cells(c.Row, "C").Text = UserForm1.correspondance.Text Then
If Not dico.exists(c.Value) And c.Value <> "" Then dico.Add c.Value, c.Value
End If
Next c
End With
a = dico.Keys
With UserForm1
For K = 0 To dico.Count - 1
.equivalence.AddItem a(K)
Next
End With
Set dico = Nothing
End Sub