|
楼主 |
发表于 2019-5-1 16:11
|
显示全部楼层
能请老师帮忙看一下哪里有错误的~谢谢
Sub 颜色提醒()
Dim arr As Variant
Dim i As Integer
With Sheet1
k = .UsedRange.Rows.Count
.Range(.Cells(4, 1), .Cells(k, 10)).Interior.Pattern = xlNone
.Range("g4:j" & k).ClearContents
For i = 3 To k
If DateValue(.Cells(i, 5)) - DateValue(Date) = 180 Then
.Cells(i, 7) = 180
.Range(.Cells(i, 1), .Cells(i, 10)).Interior.Color = 65535
End If
If DateValue(.Cells(i, 5)) - DateValue(Date) = 15 Then
.Cells(i, 7) = 15
.Range(.Cells(i, 1), .Cells(i, 10)).Interior.Color = 255
End If
If DateValue(.Cells(i, 5)) - DateValue(Date) < 0 Then
.Cells(i, 10) = "己过期,删除"
.Range(.Cells(i, 1), .Cells(i, 10)).Interior.Color = 5287936
End If
Next
End With
End Sub
|
|