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 77 78 79 80 81 82 83 84 85 86
| Sub getCashFlow()
Dim i As Integer
Dim j As Integer
Dim f As Integer
Dim start As Single
Dim a As Integer
Dim b As Integer
start = Timer
For i = 13 To 25 'VERIFIER valeur max de i'
For j = 16 To 380 'VERIFIER valeur max de j'
If Cells(i, 13).Value = 0 Or Cells(i, 13).Value <> Cells(i, 12).Value Then 'Si condition 1 (check = 0), alors faire getCalendar puis getPrice'
Call getCalendar
Call getPrice
Else: Cells(i, 13).Value = Cells(i, 12).Value 'Si condition 2 (check=calendar), alors SEULEMENT getPrice'
Call getPrice
End If
Next j
Next i
For i = 13 To 25 'VERIFIER valeur max de i'
Cells(i, 13) = Cells(i, 12)
Next i
MsgBox "durée du traitement : " & Timer - start & "secondes"
End Sub 'Fin du programme'
Sub getCalendar()
For i = 13 To 25 'vérifier valeur max de i'
For j = 16 To 380 'vérifier valeur max de j'
If Cells(12, j).Value >= WorksheetFunction.Min(Cells(i, 9).Value, Cells(i, 10).Value) And Cells(12, j).Value <= WorksheetFunction.Max(Cells(i, 9).Value, Cells(i, 10).Value) Then 'VERIFIER que cette ligne utilise bien les colonnes "Start Date" (Cells(a, 9).Value) et "Finish Date" (Cells(a,10)'
If Cells(i, 12).Value = "A" Then f = 2
If Cells(i, 12).Value = "B" Then f = 3
If Cells(i, 12).Value = "C" Then f = 4 'différentes valeurs de f à màj'
Cells(i, j).Value = Application.VLookup(Cells(12, j), Sheet2.Range("D6:G370"), f, True) 'vérifier limite du tableau pour le vlookup'
Else: Cells(i, j).Value = Cells(i, j).Value
End If
Next j
Next i
End Sub
Sub getPrice()
For a = 13 To 25 'VERIFIER valeur max de a'
For b = 16 To 380 'VERIFIER valeur max de b'
If Cells(12, b).Value >= WorksheetFunction.Min(Cells(a, 9).Value, Cells(a, 10).Value) And Cells(12, b).Value <= WorksheetFunction.Max(Cells(a, 9).Value, Cells(a, 10).Value) And Cells(a, b).Value <> 1 Then 'VERIFIER que cette ligne utilise bien les colonnes "Start Date" (Cells(a, 9).Value) et "Finish Date" (Cells(a,10)'
Cells(a, b).Value = Cells(a, 15).Value 'VERIFIER que cette ligne renvoie bien à la colonne "Daily Price"'
Else: Cells(a, b).Value = Cells(a, b).Value
End If
Next b
Next a
End Sub |
Partager