|
要求A列相同,在C列最晚一次生成日期晚于上次日期的标红色,在论坛中找了代码不知道怎么改Sub ColorR() '标准模块中
Dim arr, c As Long
With Sheets("Sheet1") 'Sheet1是要闪烁的工作表名称
.Range("A2:A" & Rows.Count).Interior.ThemeColor = 1
'For i = .Cells(Rows.Count, 2).End(xlUp).Row + 1 To .Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To .Cells(Rows.Count, 1).End(xlUp).Row
If .Cells(i, 2).Value = "" And Day(.Cells(i, 1).Value) - Day(Now()) <= 5 Then
arr = arr & "," & i
End If
Next
Do
If c = 255 Then c = 16777215 Else c = 255
t = TimeValue(Now()) + TimeValue("00:00:01")
For Each b In Split(Mid(arr, 2), ",")
.Range("A" & b).Interior.Color = c
DoEvents
Next
Do While t >= TimeValue(Now())
DoEvents
Loop
Loop
End With
End Sub
Sub Auto_Open()
Excel.Application.OnTime Now() + TimeValue("00:00:05"), "ColorR"
End Sub
|
|