|
楼主 |
发表于 2023-3-9 09:12
|
显示全部楼层
- Sub 到期提醒()
- With ActiveSheet
- .Cells.Interior.Color = xlNone
- For i = 3 To .Range("b65526").End(xlUp).Row
- If .Cells(i, "i") <> "" Then
- If Day(.Cells(i, "i")) = Day(Date) And Month(.Cells(i, "i")) = Month(Date) Then
- MsgBox Cells(i, "e") & "今日到期"
- Rows(i).Interior.ColorIndex = 45
- End If
- 距离到期的天数 = DateSerial(Year(Date), Month(.Cells(i, "i")), Day(.Cells(i, "i"))) - Date
- If 距离到期的天数 > 0 And 距离到期的天数 < 10 Then
- MsgBox Cells(i, "e") & "距离" & Day(Cells(i, "i")) - Day(Now()) & "天内到期"
- Rows(i).Interior.ColorIndex = 38 '粉色
- End If
- End If
- Next
- End With
- End Sub
复制代码 |
|