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
| Sub colorier()
Dim cpt As Integer
For cpt = 3 To 13
color_1 = ""
Start = Format(Range("H" & cpt).Value, "dd.mm.yyyy")
Target = Format(Range("I" & cpt).Value, "dd.mm.yyyy")
Current = Format(Range("J" & cpt).Value, "dd.mm.yyyy")
color_1 = "red"
If Start < Current Then
If Target > Current Then
'MsgBox cpt
color_1 = "green"
ElseIf Target < Current Then
MsgBox "test"
test = Format(Range("H" & cpt).Value, "mm")
Test2 = Format(Range("J" & cpt).Value, "mm+1")
If test > Test2 Then
color_1 = "yellow"
MsgBox "cool"
End If
End If
Else: color_1 = "red"
End If
'MsgBox "cool"
'test = Format(Range("H" & cpt).Value, "mm")
'Test2 = Format(Range("J" & cpt).Value, "mm+1")
'If test > Test2 Then
' color_1 = "yellow"
'End If
Select Case (color_1)
Case "green"
Range("K" & cpt).Select
Selection.Interior.Color = RGB(0, 224, 0)
Case "yellow"
Range("K" & cpt).Select
Selection.Interior.Color = RGB(255, 255, 0)
'MsgBox cpt
Case "red"
Range("K" & cpt).Select
Selection.Interior.Color = RGB(255, 0, 0)
End Select
Sheets("Action Plan Tracking").Range("C" & cpt) = Current
'Sheets("Action Plan Tracking").Range("B" & cpt) = cpt
Sheets("Action Plan Tracking").Range("D" & cpt) = Start
Sheets("Action Plan Tracking").Range("E" & cpt) = Target
Sheets("Action Plan Tracking").Range("C12") = Current
If Target > Current Then
Sheets("Action Plan Tracking").Range("B" & cpt) = "Sup"
End If
Next cpt
End Sub |
Partager