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
| Option Explicit
Dim i As Integer
Dim j As Integer
Dim f As Integer
Sub getCashFlow()
Dim start As Single
start = Timer
For i = 13 To 14 '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 (colonne "check" = 0) ou condition 2 (colonne "check"<>colonne "calendar"), alors faire getCalendar puis getPrice'
Call getCalendar(i, j)
Call getPrice(i, j)
Else 'Sinon (colonne "check"= colonne "calendar"), alors SEULEMENT getPrice'
Call getPrice(i, j)
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(i As Integer, j As Integer)
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
End Sub
Sub getPrice(i As Integer, j As Integer)
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) And Cells(i, j).Value <> 1 Then 'VERIFIER que cette ligne utilise bien les colonnes "Start Date" (Cells(a, 9).Value) et "Finish Date" (Cells(a,10)'
Cells(i, j).Value = Cells(i, 15).Value 'VERIFIER que cette ligne renvoie bien à la colonne "Daily Price"'
Else: Cells(i, j).Value = Cells(i, j).Value
End If
End Sub |
Partager