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
| ''REGULARISATION ECART-TEMPLATE
Dim Tablo
Dim j As Long
Dim C As Integer
Application.ScreenUpdating = False
With Sheets("SUIVTRANS EN COURS")
j = .Range("A" & Rows.Count).End(xlUp).Row
.Range("M2:M" & j).ClearContents
For j = 2 To j
NUMSIN = .Cells(j, "J")
CODECIE = .Cells(j, "H")
C = WorksheetFunction.CountIf(.Range("J2:J" & .Range("A" & Rows.Count).End(xlUp).Row), NUMSIN)
D = WorksheetFunction.CountIf(.Range("H2:H" & .Range("A" & Rows.Count).End(xlUp).Row), CODECIE)
If C > D Then .Cells(j, "M") = "REGULARISATION CIE-TEMPLATE"
Next j
Tablo = .Range("J2", "K" & .Range("K" & .Rows.Count).End(xlUp).Row)
For j = 2 To j - 1
x = 0
For i = LBound(Tablo, 1) To UBound(Tablo, 1)
If .Cells(j, "j") = Tablo(i, 1) Then
x = x + CDbl(Tablo(i, 2))
End If
Next i
If x >= -10 And x <= 10 And x <> 0 Then .Cells(j, 13) = "REGULARISATION ECART-TEMPLATE"
'Cells(j, "AA") = x
'MsgBox x
Next j
End With
Application.ScreenUpdating = True
End Sub |