|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 laijiafu 于 2013-3-18 17:01 编辑
改了下,大家看看,颜色可以自己改,但最好不变好些,综合的原作者的单元格亮显
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
On Error Resume Next
Cells.FormatConditions.Delete
'iColor = Int(50 * Rnd() + 2)
With Target.EntireRow.FormatConditions '行
.Delete
.Add xlExpression, , "TRUE"
.Item(1).Interior.ColorIndex = 24
End With
With Target.EntireColumn.FormatConditions '列
.Delete
.Add xlExpression, , "TRUE"
.Item(1).Interior.ColorIndex = 16
End With
With Target.FormatConditions '单元格
.Delete
.Add xlExpression, , "TRUE"
.Item(1).Interior.ColorIndex = 8
End With
End Sub |
|