|
Sub 标色()
With Sheet1
For col = 11 To 13 Step 2
lr = .Cells(Rows.Count, col).End(3).Row
.Cells(3, col).Resize(lr - 2).Interior.ColorIndex = 0
ar = .Cells(1, col).Resize(lr)
For i = 5 To lr - 2
If ar(i - 1, 1) > ar(i, 1) Then
If ar(i, 1) < ar(i + 1, 1) And ar(i + 1, 1) > ar(i + 2, 1) Then
.Cells(i, col).Interior.ColorIndex = 6
.Cells(i, col).Select
Exit For
End If
Else
If ar(i, 1) > ar(i + 1, 1) And ar(i + 1, 1) < ar(i + 2, 1) Then
.Cells(i, col).Interior.ColorIndex = 6
.Cells(i, col).Select
Exit For
End If
End If
Next
Next
End With
End Sub |
|