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
| Sub test()
'Dico
Dim MonDico As New Dictionary
Dim Mondico2 As New Dictionary
Dim tblE
Dim tblE2
Dim i As Integer
Dim KeyB As String
Dim KeyBase As String
Dim compt As Integer
compt = 1
Set MonDico = CreateObject("Scripting.Dictionary")
tblE = ThisWorkbook.Sheets("JUILLET").Range("A1:AJ236")
For i = 2 To 236
KeyB = tblE(i, 6) & tblE(i, 7)
MonDico.Item(KeyB) = Array(tblE(i, 1), tblE(i, 2), tblE(i, 3), tblE(i, 4), tblE(i, 5), tblE(i, 6), tblE(i, 7), tblE(i, 8), tblE(i, 9), _
tblE(i, 10), tblE(i, 11), tblE(i, 12), tblE(i, 13), tblE(i, 14), tblE(i, 15), tblE(i, 16), tblE(i, 17), tblE(i, 18), tblE(i, 19), _
tblE(i, 20), tblE(i, 21), tblE(i, 22), tblE(i, 23), tblE(i, 24), tblE(i, 25), tblE(i, 26), tblE(i, 27), tblE(i, 28), tblE(i, 29), _
tblE(i, 30), tblE(i, 31))
Next i
tblE2 = ThisWorkbook.Sheets("AOUT").Range("A1:AJ240")
For i = 2 To 240
KeyBase = tblE2(i, 6) & tblE2(i, 7)
If Not Mondico2.Exists(KeyBase) Then
Mondico2.Add compt, KeyBase
compt = compt + 1
End If
Next i
For i = 1 To 239
For j = 25 To 30
If MonDico.Exists(Mondico2(i)) Then
ThisWorkbook.Sheets("AOUT").Cells(i + 1, j + 1).Value = MonDico(Mondico2(i))(j)
End If
Next j
Next i
End sub |
Partager