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
|
Private Sub ComboBox1_Click()
Me.TextBox1 = ComboBox1
Me.ListBox1.Clear
Set f = Sheets(Me.TextBox1.Text)
Set MonDico = CreateObject("Scripting.Dictionary")
bd = f.Range("B9:B" & f.[F65000].End(xlUp).Row) ' tableau bd(n,1) pour rapidité
For i = LBound(bd) To UBound(bd)
If bd(i, 1) <> "" Then MonDico(bd(i, 1)) = ""
Next i
Me.ListBox1.List = MonDico.keys
'--avec tri
temp = MonDico.keys
Call Tri(temp, LBound(temp), UBound(temp))
Me.ListBox1.List = temp
With ListBox1
Image1.Picture = Controls("Risque" & .List(.ListIndex, 0)).Picture
Image2.Picture = Controls("Risque" & .List(.ListIndex + 1, 0)).Picture
Image3.Picture = Controls("Risque" & .List(.ListIndex + 2, 0)).Picture
Image4.Picture = Controls("Risque" & .List(.ListIndex + 3, 0)).Picture
Image5.Picture = Controls("Risque" & .List(.ListIndex + 4, 0)).Picture
Image6.Picture = Controls("Risque" & .List(.ListIndex + 5, 0)).Picture
Image7.Picture = Controls("Risque" & .List(.ListIndex + 6, 0)).Picture
Image8.Picture = Controls("Risque" & .List(.ListIndex + 7, 0)).Picture
Image9.Picture = Controls("Risque" & .List(.ListIndex + 8, 0)).Picture
Image10.Picture = Controls("Risque" & .List(.ListIndex + 9, 0)).Picture
Image11.Picture = Controls("Risque" & .List(.ListIndex + 10, 0)).Picture
Image12.Picture = Controls("Risque" & .List(.ListIndex + 11, 0)).Picture
Image13.Picture = Controls("Risque" & .List(.ListIndex + 12, 0)).Picture
Image14.Picture = Controls("Risque" & .List(.ListIndex + 13, 0)).Picture
Image15.Picture = Controls("Risque" & .List(.ListIndex + 14, 0)).Picture
End With
End Sub |
Partager