|
本帖最后由 jiahua1010 于 2012-2-18 23:56 编辑
A16:jiahua1010- Private Sub Worksheet_Change(ByVal Target As Range)
- For i = 2 To Range("d65536").End(xlUp).Row
- If Cells(i, 4) - Now() > 3 Then
- Range(Cells(i, 1), Cells(i, 6)).Interior.ColorIndex = 0
- ElseIf Cells(i, 4) <> "" And Cells(i, 5) = "" Then
- Range(Cells(i, 1), Cells(i, 6)).Interior.ColorIndex = 3
- ElseIf Cells(i, 4) <> "" And Cells(i, 5) <> "" Then
- Range(Cells(i, 1), Cells(i, 6)).Interior.ColorIndex = 34
- End If
- Next
- End Sub
复制代码- Private Sub Worksheet_Change(ByVal Target As Range)
- With Target
- If (.Column = 4 Or .Column = 5) And .Row <> 1 Then
- If Cells(.Row, 4) = "" Or Cells(.Row, 4) - Now() > 3 Then
- Range(Cells(.Row, 1), Cells(.Row, 6)).Interior.ColorIndex = 0
- ElseIf Cells(.Row, 4) <> "" And Cells(.Row, 5) = "" Then
- Range(Cells(.Row, 1), Cells(.Row, 6)).Interior.ColorIndex = 3
- ElseIf Cells(.Row, 4) <> "" And Cells(.Row, 5) <> "" Then
- Range(Cells(.Row, 1), Cells(.Row, 6)).Interior.ColorIndex = 34
- End If
- End If
- End With
- End Sub
复制代码- Private Sub Worksheet_Change(ByVal Target As Range)
- With Target
- If (.Column = 4 Or .Column = 5) And .Row <> 1 Then
- If Cells(.Row, 4) = "" Or Cells(.Row, 4) - Now() > 3 Then
- Range("a" & .Row & ":f" & .Row).Interior.ColorIndex = 0
- ElseIf Cells(.Row, 4) <> "" And Cells(.Row, 5) = "" Then
- Range("a" & .Row & ":f" & .Row).Interior.ColorIndex = 3
- ElseIf Cells(.Row, 4) <> "" And Cells(.Row, 5) <> "" Then
- Range("a" & .Row & ":f" & .Row).Interior.ColorIndex = 34
- End If
- End If
- End With
- End Sub
复制代码
|
评分
-
查看全部评分
|