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
| Set F3 = Sheets("Resultat")
Dim LigneF3 As Long
LigneF3 = F3.Cells(Rows.Count, 3).End(xlUp).Row
If LigneF3 > 1 Then F3.Range("A2 : M" & LigneF3).ClearContents
Dim i As Long
Dim L As Integer
L = 2
'**********************************************************
TblBD = F2.Range("A2:F" & F2.Range("F" & Rows.Count).End(xlUp).Row)
For i = 1 To UBound(TblBD)
If TblBD(i, 6) <> "" Then
F3.Cells(L, 1) = L - 1
F3.Cells(L, 1).NumberFormat = "0000"
F3.Cells(L, 3) = TblBD(i, 1)
F3.Cells(L, 4) = TblBD(i, 2)
F3.Cells(L, 5) = TblBD(i, 3)
F3.Cells(L, 11) = TblBD(i, 4)
F3.Cells(L, 12) = TblBD(i, 5)
F3.Cells(L, 13) = TblBD(i, 6)
L = L + 1
End If
Next i
Dim LigneF1 As Long
Dim J As Long
LigneF1 = F1.Range("B" & Rows.Count).End(xlUp).Row
LigneF3 = F3.Cells(Rows.Count, 3).End(xlUp).Row
With F3
On Error Resume Next
For J = 2 To LigneF3
.Cells(J, 6) = WorksheetFunction.VLookup(.Cells(J, 4), F1.Range("E2:M" & LigneF1), 5, 0)
.Cells(J, 6) = WorksheetFunction.VLookup(.Cells(J, 5), F1.Range("F2:M" & LigneF1), 4, 0)
.Cells(J, 7) = WorksheetFunction.VLookup(.Cells(J, 4), F1.Range("E2:M" & LigneF1), 6, 0)
.Cells(J, 7) = WorksheetFunction.VLookup(.Cells(J, 5), F1.Range("f2:M" & LigneF1), 5, 0)
.Cells(J, 8) = WorksheetFunction.VLookup(.Cells(J, 4), F1.Range("E2:M" & LigneF1), 7, 0)
.Cells(J, 8) = WorksheetFunction.VLookup(.Cells(J, 5), F1.Range("f2:M" & LigneF1), 6, 0)
.Cells(J, 9) = WorksheetFunction.VLookup(.Cells(J, 4), F1.Range("E2:M" & LigneF1), 8, 0)
.Cells(J, 9) = WorksheetFunction.VLookup(.Cells(J, 5), F1.Range("f2:M" & LigneF1), 7, 0)
.Cells(J, 10) = WorksheetFunction.VLookup(.Cells(J, 4), F1.Range("E2:M" & LigneF1), 9, 0)
.Cells(J, 10) = WorksheetFunction.VLookup(.Cells(J, 5), F1.Range("f2:M" & LigneF1), 8, 0)
Next J
End With
'Attribution des ATD *****************************************************************************
ANNEE = Year(Date)
Set mondico = CreateObject("Scripting.Dictionary")
i = 1
For Each c In F3.Range([d2], [d65000].End(xlUp))
temp = c.Value & c.Offset(, 1).Value
If Not mondico.exists(temp) Then
mondico(temp) = i
i = i + 1
End If
c.Offset(, -2) = Format(mondico.Item(temp), "0000") & "/" & ANNEE
Next c
Application.ScreenUpdating = True
F3.Select
End Sub |
Partager