Private Sub UserForm_Activate()
Dim d1 As Object
Dim d2 As Object
Dim d3 As Object
Dim i As Integer
Dim ws As Worksheet
With ListBox1
.ColumnCount = 9
.ColumnWidths = "40;90;230;70;60;60;60;60;40"
.Column = Array("Ligne", "Souche", "Dénomination", "Bague", "Année", "Sexe", "Prix", "Souche2", "Destination")
End With
With ListBox2
.ColumnCount = 9
.ColumnWidths = "40;90;230;70;60;60;60;60;40"
End With
With ListBox3
.ColumnCount = 9
.ColumnWidths = "40;90;230;70;60;60;60;60;40"
End With
'****************************************************************
Set d1 = CreateObject("Scripting.Dictionary")
Set d2 = CreateObject("Scripting.Dictionary")
Set d3 = CreateObject("Scripting.Dictionary")
Set Fs = ThisWorkbook.Worksheets("vente")
Set F1 = ThisWorkbook.Worksheets("DE_V")
Set F2 = ThisWorkbook.Worksheets("DE_P")
'Sheets("Base").Activate
Tb = Fs.Range("A2:I" & Fs.Range("A" & Rows.Count).End(xlUp).Row).Value
For i = 2 To UBound(Tb) 'pourquoi à partir de 2? - Cette boucle peut créer x fois la meme clé, juste pour la vider...
d1(Tb(i, 2)) = ""
d2(Tb(i, 9)) = ""
Next i
If d1.Count > 0 Then Me.ComboBox1.List = d1.keys
If d2.Count > 0 Then Me.ComboBox2.List = d2.keys
Me.ListBox2.List = Tb
'****************************************************************
Tb1 = ActiveSheet.Range("A11:I" & Fs.Range("A" & Rows.Count).End(xlUp).Row).Value '==> l'active sheet, c'est la feuille BASE...???
For i = 11 To UBound(Tb1)
d3(Tb1(i, 9)) = ""
Next i
If d3.Count > 0 Then Me.ComboBox5.List = d3.keys
Me.ListBox3.List = Tb1
'****************************************************************
'pourquoi refaire tout ce bloc d'instructions?
Set d1 = CreateObject("Scripting.Dictionary")
Set d2 = CreateObject("Scripting.Dictionary")
Set Fs = ThisWorkbook.Worksheets("vente")
Set F1 = ThisWorkbook.Worksheets("DE_V")
Tb = Fs.Range("A2:I" & Fs.Range("A" & Rows.Count).End(xlUp).Row).Value
For i = 2 To UBound(Tb)
d1(Tb(i, 2)) = ""
d2(Tb(i, 9)) = ""
Next i
If d1.Count > 0 Then Me.ComboBox1.List = d1.keys
If d2.Count > 0 Then Me.ComboBox2.List = d2.keys
Me.ListBox2.List = Tb
'****************************************************************
For Each ws In ActiveWorkbook.Sheets
If ws.Name <> "base" And ws.Name <> "certificat" And ws.Name <> "DSV" And ws.Name <> "liste_participants" And ws.Name <> "codes" And ws.Name <> "DE_V" And ws.Name <> "DE_P" And ws.Name <> "vente" And ws.Name <> "VE" And ws.Name <> "eleveurs" And ws.Name <> "modele" Then
ComboBox4.AddItem ws.Name
End If
Next ws
ComboBox5.List = Array("P")
End Sub