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
| Private Sub UserForm_Initialize()
Dim tboextract As Variant
Dim tboExtract2 As Variant
Dim I
Dim Unseul As New Collection
Dim Unseul2 As New Collection
Dim strElt As Variant
Dim strElt2 As Variant
Dim j
Set f = ActiveSheet
'LISTE DS TEXTBOX
For n = 1 To 10
If f.Cells(2, n) <> "" Then
suite = suite & f.Cells(2, n) & ";"
End If
Next n
tboextract = Split(suite, ";")
On Error Resume Next
For I = 0 To UBound(tboextract)
Unseul.Add tboextract(I), tboextract(I)
Next I
For Each strElt In Unseul
j = j + 1
UserForm1.Controls("TextBox" & j).Value = strElt
Next
On Error GoTo 0
'LISTE DE SUITE 3
Dim tboextract3 As Variant
Dim Unseul3 As New Collection
Dim strElt3 As Variant
k = 0
CheckBox1 = True
For j = 1 To 3
Set Unseul3 = Nothing
Set Unseul3 = New Collection
suite2 = ""
k = 0
If UserForm1.Controls("checkbox" & j) = True And UserForm1.Controls("TextBox" & j).Value <> "" Then
For n = 1 To 10
If f.Cells(2, n) = UserForm1.Controls("TextBox" & j).Value Then
suite2 = suite2 & f.Cells(1, n) & ";"
End If
Next n
tboextract3 = Split(suite2, ";")
On Error Resume Next
For I = 0 To UBound(tboextract3)
Unseul3.Add tboextract3(I), tboextract3(I)
Next I
Do Until Cells(6 + P, 2) = ""
P = P + 1
Loop
For Each strElt3 In Unseul3
k = k + 1
f.Cells(5 + P + k, 2).Value = strElt3
If f.Cells(5 + P + k, 2).Value <> "" Then
f.Cells(5 + P + k, 1).Value = UserForm1.Controls("TextBox" & j).Value
End If
'If k = 1 Then
'f.Cells(6 + p, 1).Value = UserForm1.Controls("TextBox" & j).Value
'End If
Next
End If
Next j
On Error GoTo 0
End Sub |
Partager