|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Private Sub Worksheet_Activate()
- r = [a65536].End(3).Row
- For i = 5 To r
- day1 = Cells(i, 3): day2 = Cells(i, 5): day3 = Cells(i, 7)
- Cells(i, "H").Interior.ColorIndex = 0
- If day1 = "/" Or day2 = "/" Or day3 = "/" Then
- Cells(i, "H") = "无需"
- Else
- maxday = day1
- If day2 > maxday Then maxday = day2
- If day3 > maxday Then maxday = day3
- expday = maxday - Date
- If expday < 60 Then Cells(i, "H") = "快到期": Cells(i, "H").Interior.Color = vbYellow
- If expday < 0 Then Cells(i, "H") = "已过期": Cells(i, "H").Interior.Color = vbRed
- End If
- Next
- End Sub
复制代码 |
|