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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
| Dim f
Private Sub UserForm_Initialize()
Set f = Sheets("LEGIS")
Set Mondico = CreateObject("Scripting.Dictionary")
For Each c In f.Range("A4:A" & f.[A65000].End(xlUp).Row)
Mondico(c.Value) = ""
Next c
temp = Mondico.keys
Call Tri(temp, LBound(temp), UBound(temp))
Me.ComboBox1.List = temp
End Sub
Private Sub ComboBox1_click()
Me.ComboBox2.Clear
Me.ComboBox3.Clear
Me.ComboBox4.Clear
Set Mondico = CreateObject("Scripting.Dictionary")
For Each c In f.Range("A4:A" & f.[A65000].End(xlUp).Row)
If c = Me.ComboBox1 Then Mondico(c.Offset(, 1).Value) = ""
Next c
temp = Mondico.keys
Call Tri(temp, LBound(temp), UBound(temp))
Me.ComboBox2.List = temp
End Sub
Private Sub ComboBox2_click()
Me.ComboBox3.Clear
Me.ComboBox4.Clear
Set Mondico = CreateObject("Scripting.Dictionary")
For Each c In f.Range("A4:A" & f.[A65000].End(xlUp).Row)
If c = Me.ComboBox1 And c.Offset(, 1) = Me.ComboBox2 Then Mondico(c.Offset(, 2).Value) = ""
Next c
temp = Mondico.keys
Call Tri(temp, LBound(temp), UBound(temp))
Me.ComboBox3.List = temp
End Sub
Private Sub ComboBox3_click()
Me.ComboBox4.Clear
Set Mondico = CreateObject("Scripting.Dictionary")
For Each c In f.Range("A4:A" & f.[A65000].End(xlUp).Row)
If c = Me.ComboBox1 And c.Offset(, 1) = Me.ComboBox2 And c.Offset(, 2).Value = Me.ComboBox3 Then Mondico(c.Offset(, 3).Value) = ""
Next c
temp = Mondico.keys
Call Tri(temp, LBound(temp), UBound(temp))
Me.ComboBox4.List = temp
End Sub
Private Sub ComboBox4_click()
For Each c In f.Range("A4:A" & f.[A65000].End(xlUp).Row)
If c = Me.ComboBox3 And c.Offset(, 3) = Me.ComboBox4 Then Me.TextBox1 = c.Offset(, 5)
If c = Me.ComboBox1 And c.Offset(, 1) = Me.ComboBox2 And c.Offset(, 2).Value = Me.ComboBox3 And c.Offset(, 3).Value = Me.ComboBox4 Then Me.TextBox1 = c.Offset(, 4)
If c = Me.ComboBox3 And c.Offset(, 3) = Me.ComboBox4 Then Me.TextBox2 = c.Offset(, 6)
If c = Me.ComboBox1 And c.Offset(, 1) = Me.ComboBox2 And c.Offset(, 2).Value = Me.ComboBox3 And c.Offset(, 3).Value = Me.ComboBox4 Then Me.TextBox2 = c.Offset(, 5)
Next c
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
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub CommandButton2_Click()
Unload Me
UserForm1.Show
End Sub
Private Sub CommandButton3_Click()
With TextBox1
.SelStart = 0
.SelLength = Len(TextBox1)
.Copy
End With
End Sub
Private Sub CommandButton4_Click()
With TextBox2
.SelStart = 0
.SelLength = Len(TextBox2)
.Copy
End With
End Sub |
Partager