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
| Sub Check_Package_Argentine()
Dim tablo50
Dim cf As CashFlow
Dim sommeInterets, packageNumber, verif As Double
Dim i, j, k As Integer
Set listeCF = New Collection
sommeInterets = 0
verif = 0
Application.ScreenUpdating = False
'passage en mode de calcul manuel
Application.Calculation = xlManual
Sheets("7-Argentine-OPU").Activate
i = 4
While Cells(i, 9).Value <> "" ' alors ici tu boucle tans qu'il y a queleque chose dans la cells i,9
' tu pourrais faire comme le permier determiner la plage ca aurait été plus rapide
ReDim Preserve tablo50(0 To i, 0 To 2)
If Right(Cells(i, 9).Value, 3) = "AVA" Then
'Set cf = New CashFlow
' cf.packageNumber = Range("F" & i).Value
tablo50(i, 0) = Range("F" & i).Value
'cf.montant = Range("Y" & i).Value
'listeCF.Add cf
tablo50(i, 1) = Range("Y" & i).Value
End If
i = i + 1
Wend
For i = 1 To UBound(tablo50)
For j = i + 1 To UBound(tablo50)
If tablo50(i, 1) = tablo50(j, 1) Then
sommeInterets = 0
sommeInterets = sommeInterets + tablo50(i, 1) + tablo50(j, 1)
MsgBox "les intérêts du package argentine " & tablo50(i, 1) & " sont de " & sommeInterets
k = 4
While Sheets("1-OperationsDuJour").Range("I" & k).Value <> tablo50(i, 1)
k = k + 1
Wend
If Sheets("1-OperationsDuJour").Range("I" & k).Value = tablo50(i, 0) Then
verif = (Sheets("1-OperationsDuJour").Range("U" & k).Value) + sommeInterets
If Abs(verif) < 10 Then
MsgBox "L'opération argentine du package " & tablo50(i, 0) & " correspond bien aux opérations avances, la somme du forward et des intérêts de l'opération est égale à " & verif & "!"
Else
MsgBox "Il n'y a pas de correspondance entre l'avance argentine et le forward associé au numéro de package " & tablo50(i, 0) & ", la somme du forward et des intérêts de l'opération est égale à " & verif & "!, vérifiez manuellement!"
End If
End If
End If
Next j
Next i
End Sub |
Partager