这样 不需要 提前设置 条件格式 , 事件程序中 自行设定.
======================================
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row > 1200 Or Target.Column > 14 Then Exit Sub
On Error Resume Next
Cells.FormatConditions.Delete
With Range("A1").Offset(0, Target.Column - 1).Resize(Target.Row, 1).FormatConditions
' 现在 是丁字形 , 根据需要 把 蓝字 再 +100 , 或者把蓝字 改写为固定值 .
.Delete
.Add xlExpression, , "TRUE"
.Item(1).Interior.ColorIndex = 28
End With
With Range("A1").Offset(Target.Row - 1, 0).Resize(1, 10).FormatConditions
.Delete
.Add xlExpression, , "TRUE"
.Item(1).Interior.ColorIndex = 22
End With
End Sub
|