回答編集履歴
1
修正
answer
CHANGED
@@ -29,25 +29,26 @@
|
|
29
29
|
Private Sub Worksheet_Change(ByVal Target As Range)
|
30
30
|
Dim i As Long
|
31
31
|
Dim j As Long
|
32
|
-
Dim mycell As Range,
|
32
|
+
Dim mycell As Range, diff As Long, mycolor As Long
|
33
33
|
|
34
34
|
For i = 4 To Cells(Rows.Count, 1).End(xlUp).Row
|
35
35
|
For j = 8 To 15
|
36
36
|
Set mycell = Cells(i, j)
|
37
37
|
If mycell <> "" Then
|
38
38
|
diff = DateDiff("d", mycell, Date)
|
39
|
-
Set colorcell = Range(Cells(i, 3), Cells(i, 7))
|
40
39
|
If 30 <= diff Then
|
41
|
-
|
40
|
+
mycolor = RGB(255, 0, 0)
|
42
41
|
ElseIf 14 <= diff Then
|
43
|
-
|
42
|
+
mycolor = RGB(255, 255, 0)
|
44
43
|
ElseIf 7 <= diff Then
|
45
|
-
|
44
|
+
mycolor = RGB(0, 255, 255)
|
46
45
|
ElseIf 7 > diff Then
|
47
|
-
|
46
|
+
mycolor = RGB(255, 255, 255)
|
48
47
|
End If
|
48
|
+
Range(Cells(i, 3), Cells(i, 7)).Interior.Color = mycolor
|
49
49
|
End If
|
50
50
|
Next
|
51
51
|
Next
|
52
52
|
End Sub
|
53
|
+
|
53
54
|
```
|