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
| Sub test()
Dim Lig As Integer ' N° ligne traitée
Dim Res(10, 10, 10) As Integer ' Résultats (Machine, Ref, Date)
Dim Ind(5) As Integer ' Indices pour Res
For Lig = 2 To Cell(2, 1).End(xlDown).Row
' ----- MACHINE -----
Select Case Cells(Lig, 5).Value
Case "AB3078P"
Ind(1) = 1
Case "AB3177P"
Ind(1) = 2
Case "VI7110G"
Ind(1) = 3
Case Else
Ind(1) = 10
End Select
' ----- REF -----
Select Case Cells(Lig, 3).Value
Case "PF176"
Ind(2) = 1
Case Else
Ind(2) = 10
End Select
' ----- DATE -----
Select Case Cells(Lig, 2).Value
Case Is < DateSerial(2014, 9, 1)
Ind(3) = 1
Case Is < DateSerial(2014, 10, 1)
Ind(3) = 2
Case Is < DateSerial(2014, 11, 1)
Ind(3) = 3
Case Else
Ind(3) = 10
End Select
Res(Ind(1), Ind(2), Ind(3)) = Res(Ind(1), Ind(2), Ind(3)) + Cells(Lig, 7)
Next Lig
End Sub |
Partager