Private Sub UserForm_Initialize()
Set f = Sheets("Installations")
BD = f.Range("A2:AY" & f.[A65000].End(xlUp).Row).Value
'--- combobox villes trié
Set d = CreateObject("Scripting.Dictionary")
For i = LBound(BD) To UBound(BD)
d(BD(i, 2)) = ""
Next i
temp = d.keys
Tri temp, LBound(temp), UBound(temp)
Me.Recherche_SiteCbx.List = temp
'--- combobox profession trié
Set d = CreateObject("Scripting.Dictionary")
For i = LBound(BD) To UBound(BD)
d(BD(i, 5)) = ""
Next i
temp = d.keys
Tri temp, LBound(temp), UBound(temp)
Me.Recherche_DomaineCbx.List = temp
'---
TriMult BD, LBound(BD), UBound(BD), 1
Me.ListBox1.List = BD
Set d = CreateObject("Scripting.Dictionary")
For i = LBound(BD) To UBound(BD)
d(BD(i, 5)) = ""
Next i
temp = d.keys
Tri temp, LBound(temp), UBound(temp)
Me.Recherche_CfhCbx.List = temp
'---
TriMult BD, LBound(BD), UBound(BD), 1
Me.ListBox1.List = BD
End Sub
Private Sub Recherche_SiteCbx_click()
If Me.Recherche_DomaineCbx <> Me.Recherche_CfhCbx <> "" Then
Clé1 = Me.Recherche_SiteCbx: colClé1 = 2
Clé2 = Me.Recherche_DomaineCbx: colClé2 = 5
Clé3 = Me.Recherche_CfhCbx: colClé2 = 7
b = FiltreMultiCol2Transp(BD, colClé1, Clé1, Array(1, 2, 3, 4, 5, 6, 7), colClé2, Clé2, colClé3, Clé3)
If Not IsEmpty(b) Then Me.ListBox1.Column = b Else Me.ListBox1.Clear
Else
Clé1 = Me.Recherche_SiteCbx: colClé1 = 2
b = FiltreMultiCol2Transp(BD, colClé1, Clé1, Array(1, 2, 3, 4, 5, 6, 7))
If Not IsEmpty(b) Then Me.ListBox1.Column = b Else Me.ListBox1.Clear
End If
End Sub
Private Sub Recherche_DomaineCbx_click()
If Me.Recherche_SiteCbx <> Me.Recherche_CfhCbx <> "" Then
Clé1 = Me.Recherche_SiteCbx: colClé1 = 2
Clé2 = Me.Recherche_DomaineCbx: colClé2 = 5
Clé3 = Me.Recherche_CfhCbx: colClé2 = 7
b = FiltreMultiCol2Transp(BD, colClé1, Clé1, Array(1, 2, 3, 4, 5, 6, 7), colClé2, Clé2, colClé3, Clé3)
If Not IsEmpty(b) Then Me.ListBox1.Column = b Else Me.ListBox1.Clear
Else
Clé1 = Me.Recherche_DomaineCbx: colClé1 = 5
b = FiltreMultiCol2Transp(BD, colClé1, Clé1, Array(1, 2, 3, 4, 5, 6, 7))
If Not IsEmpty(b) Then Me.ListBox1.Column = b Else Me.ListBox1.Clear
End If
End Sub
Private Sub Recherche_CfhCbx_click()
If Me.Recherche_SiteCbx <> Me.Recherche_DomaineCbx_click <> "" Then
Clé1 = Me.Recherche_SiteCbx: colClé1 = 2
Clé2 = Me.Recherche_DomaineCbx: colClé2 = 5
Clé3 = Me.Recherche_CfhCbx: colClé2 = 7
b = FiltreMultiCol2Transp(BD, colClé1, Clé1, Array(1, 2, 3, 4, 5, 6, 7), colClé2, Clé2, colClé3, Clé3)
If Not IsEmpty(b) Then Me.ListBox1.Column = b Else Me.ListBox1.Clear
Else
Clé1 = Me.Recherche_DomaineCbx: colClé1 = 5
b = FiltreMultiCol2Transp(BD, colClé1, Clé1, Array(1, 2, 3, 4, 5, 6, 7))
If Not IsEmpty(b) Then Me.ListBox1.Column = b Else Me.ListBox1.Clear
End If
End Sub
Sub TriMult(a, gauc, droi, ColTri) ' Quick sort
Ref = a((gauc + droi) \ 2, ColTri)
g = gauc: d = droi
Do
Do While a(g, ColTri) < Ref: g = g + 1: Loop
Do While Ref < a(d, ColTri): d = d - 1: Loop
If g <= d Then
For c = LBound(a, 2) To UBound(a, 2)
temp = a(g, c): a(g, c) = a(d, c): a(d, c) = temp
Next
g = g + 1: d = d - 1
End If
Loop While g <= d
If g < droi Then Call TriMult(a, g, droi, ColTri)
If gauc < d Then Call TriMult(a, gauc, d, ColTri)
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