Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("C7:C42")) Is Nothing Then
If Target <> "" And Time <= "08:00:00" Then Target.Interior.Color = RGB(255, 255, 255)
If Target <> "" And Time > "08:00:00" And Time <= "16:00:00" Then Target.Interior.Color = RGB(127, 127, 127)
If Target <> "" And Time > "16:00:00" Then
Target.Interior.Color = RGB(0, 0, 0)
Target.Font.Color = RGB(255, 255, 255)
End If
End If
If Not Intersect([f7:f65], Target) Is Nothing And Target.Count = 1 Then
codes = Split(Target, ":")
For i = LBound(codes) To UBound(codes)
If IsNumeric(codes(i)) Then
nature = Application.VLookup(Val(codes(i)), [codesMIP], 2, False)
Else
nature = Application.VLookup(codes(i), [codesMIP], 2, False)
End If
If Not IsError(nature) Then
tmp = tmp & nature & ", "
End If
Next i
'Application.EnableEvents = False
If tmp <> "" Then
Target.Offset(, 1) = Left(tmp, Len(tmp) - 2)
Else
Target.Offset(, 1) = ""
End If
'Application.EnableEvents = True
End If
End Sub