回答編集履歴

1

修正

2021/02/10 02:27

投稿

jinoji
jinoji

スコア4592

test CHANGED
@@ -60,7 +60,7 @@
60
60
 
61
61
  Dim j As Long
62
62
 
63
- Dim mycell As Range, colorcell As Range, diff As Long
63
+ Dim mycell As Range, diff As Long, mycolor As Long
64
64
 
65
65
 
66
66
 
@@ -74,25 +74,25 @@
74
74
 
75
75
  diff = DateDiff("d", mycell, Date)
76
76
 
77
- Set colorcell = Range(Cells(i, 3), Cells(i, 7))
78
-
79
77
  If 30 <= diff Then
80
78
 
81
- colorcell.Interior.Color = RGB(255, 0, 0)
79
+ mycolor = RGB(255, 0, 0)
82
80
 
83
81
  ElseIf 14 <= diff Then
84
82
 
85
- colorcell.Interior.Color = RGB(255, 255, 0)
83
+ mycolor = RGB(255, 255, 0)
86
84
 
87
85
  ElseIf 7 <= diff Then
88
86
 
89
- colorcell.Interior.Color = RGB(0, 255, 255)
87
+ mycolor = RGB(0, 255, 255)
90
88
 
91
89
  ElseIf 7 > diff Then
92
90
 
93
- colorcell.Interior.Color = RGB(255, 255, 255)
91
+ mycolor = RGB(255, 255, 255)
94
92
 
95
93
  End If
94
+
95
+ Range(Cells(i, 3), Cells(i, 7)).Interior.Color = mycolor
96
96
 
97
97
  End If
98
98
 
@@ -102,4 +102,6 @@
102
102
 
103
103
  End Sub
104
104
 
105
+
106
+
105
107
  ```