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
| Sub TRANSFERT_TERMINEES_IW()
Dim i As Integer
Dim valeur As String
Sheets("Terminées").Select
i = 3 'ligne 3
Do Until Cells(i, 1) = "" 'départ Bruts ligne i, colonne 1
valeur = Cells(i, 1)
Cells(i, 5) = trouveIW(valeur, 3) 'Stock
Cells(i, 7) = trouveIW(valeur, 4) 'Echu
Cells(i, 8) = trouveIW(valeur, 5) 'S+1
Cells(i, 9) = trouveIW(valeur, 6) 'S+2
Cells(i, 10) = trouveIW(valeur, 7) 'S+3
Cells(i, 11) = trouveIW(valeur, 8) 'S+4
Cells(i, 12) = trouveIWmois(valeur, 4) 'M+1 2009
Cells(i, 13) = trouveIWmois(valeur, 5) 'M+2
Cells(i, 14) = trouveIWmois(valeur, 6) 'M+3
i = i + 1
Loop
Application.CutCopyMode = False
Range("A3").Activate
End Sub
Function trouveIW(valeur As String, colonne As Integer)
Dim J As Integer
Dim trouve As String
Sheets("TCD").Select
J = 5
trouve = ""
Do Until Cells(J, 1) = "" Or trouve <> ""
If Cells(J, 1) = valeur Then
trouve = Cells(J, colonne)
End If
J = J + 1
Loop
trouveIW = trouve
Sheets("Terminées").Select
End Function
Function trouveIWmois(valeur As String, colonne As Integer)
Dim J As Integer
Dim trouve As String
Sheets("TCD_Mois").Select
J = 4
trouve = ""
Do Until Cells(J, 1) = "" Or trouve <> ""
If Cells(J, 1) = valeur Then
trouve = Cells(J, colonne)
End If
J = J + 1
Loop
trouveIWmois = trouve
Sheets("Terminées").Select
End Function |
Partager