Private Sub ComboBox1_GotFocus()
Dim d As Object, c As Range, a
Set d = CreateObject("Scripting.Dictionary")
[AC1] = "=""Tout"""
For Each c In [AC:AC].SpecialCells(xlCellTypeFormulas)
If c <> "" Then d(c.Value) = ""
Next
[AC1] = ""
a = d.keys
If d.Count > 1 Then: tri a, 1, UBound(a)
ComboBox1.List = Application.Transpose(a)
ComboBox1 = ""
ComboBox1.DropDown
End Sub
Private Sub ComboBox1_Change()
If ComboBox1.ListIndex = -1 Then Exit Sub
Dim critere$
critere = IIf(ComboBox1 = "Tout", "?*", ComboBox1)
[AC3:AK1000].AutoFilter 1, critere
PageSetup.PrintArea = Range("AC1", AutoFilter.Range).Address
'PrintPreview
PrintOut
AutoFilterMode = False
End Sub
Sub tri(a, gauc, droi) ' Quick sort
Dim ref, g, d, temp
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