Excel 选中单元格行列自动变色设置
Excel行列选中变色
1. 操作
a) ALT+F11,进入VBE编辑器
b) 双击Sheet1标签,粘贴如下代码:
2. 代码
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) On Error Resume Next
Cells.FormatConditions.Delete
With Target.EntireRow.FormatConditions
.Delete
.Add xlExpression, , "TRUE"
.Item(1).Interior.ColorIndex = 35
End With
With Target.EntireColumn.FormatConditions
.Delete
.Add xlExpression, , "TRUE"
.Item(1).Interior.ColorIndex = 35
End With
End Sub
3. 颜色表
4. 效果预览
相关主题