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
|
Sub Test()
Dim Tbl(1 To 2, 1 To 7)
Dim TSegment
Dim TDate
Dim DifDate As Long
Dim Col As Long
Dim I As Long
Dim J As Long
Dim K As Integer
TSegment = Array("Commande", "Intermédiaire 1", "Intermédiaire 2", "Intermédiaire 3", "Intermédiaire 4", "Intermédiaire 5", "Livraison")
TDate = Array("01/01/2018", "01/03/2018", "01/04/2018", "01/08/2018", "01/09/2018", "01/11/2018", "01/01/2019")
For I = 1 To 7
Tbl(1, I) = TSegment(I - 1)
Tbl(2, I) = CDate(TDate(I - 1))
Next I
DifDate = Tbl(2, UBound(Tbl, 2)) - Tbl(2, LBound(Tbl, 2))
Application.ScreenUpdating = False
For I = 1 To DifDate: Columns(I).ColumnWidth = 1: Next I
Application.ScreenUpdating = True
K = 2
For I = LBound(Tbl, 2) To UBound(Tbl, 2) - 1
K = K + 1
Range(Cells(2, J + 1), Cells(2, J + (Tbl(2, I + 1) - Tbl(2, I)))).Interior.ColorIndex = K
Col = J + 1 + CLng(((J + (Tbl(2, I + 1) - Tbl(2, I))) - (J + 1)) / 2)
Cells(1, Col).Value = Tbl(1, I)
J = J + (Tbl(2, I + 1) - Tbl(2, I))
Next I
End Sub |
Partager