Private Sub Worksheet_Activate()
Me.ComboBox1.Clear
Set f = Sheets("DONNEES GRAPHIQUE")
Set mondico = CreateObject("Scripting.Dictionary")
a = f.Range("I5:I" & f.[I65000].End(xlUp).Row) ' tableau a(n,1) pour rapidité
For I = LBound(a) To UBound(a)
If a(I, 1) <> "" Then mondico(a(I, 1)) = ""
Next I
'--avec tri
temp = mondico.keys
Call Tri(temp, LBound(temp), UBound(temp))
Me.ComboBox1.List = temp
'Me.ComboBox1.List = ListFormat(f.[I5:I509].Value, "#0.00000")
End Sub
Sub Tri(a, gauc, droi) ' Quick sort
ref = a((gauc + droi) \ 2)
g = gauc: d = droi
Do
Do While a(g) < ref: g = g + 1: Loop
Do While ref < a(d): d = d - 1: Loop
If g <= d Then
temp = a(g): a(g) = a(d): a(d) = temp
g = g + 1: d = d - 1
End If
Loop While g <= d
If g < droi Then Call Tri(a, g, droi)
If gauc < d Then Call Tri(a, gauc, d)
End Sub
Function ListFormat(tbl, forme)
Dim I&
For I = 1 To UBound(tbl)
Select Case LCase(forme)
Case "maj": tbl(I, 1) = UCase(tbl(I, 1))
Case "min": tbl(I, 1) = LCase(tbl(I, 1))
Case "proper": tbl(I, 1) = WorksheetFunction.Proper(tbl(I, 1))
'ect..etc..
Case Else: tbl(I, 1) = Format(tbl(I, 1), forme)
End Select
Next
ListFormat = tbl
End Function