表格Sheet 右击:查看代码 输入控制代码。ctrl+S 点击是,关闭窗口。
请看视频教程:
单元格-行列变色 点击表格显示颜色 表格定位
主要code:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
On Error Resume Next
Cells.FormatConditions.Delete
ColorNum = 37
With Target.EntireRow.FormatConditions
.Delete
.Add xlExpression, , "TRUE"
.Item(1).Interior.ColorIndex = ColorNum
End With
With Target.EntireColumn.FormatConditions
.Delete
.Add xlExpression, , "TRUE"
.Item(1).Interior.ColorIndex = ColorNum
End With
End Sub
注:
1、EntireRow//行,EntireColumn//列;
2、颜色代码请看:
3、excel 无法在未启用宏的工作簿中保存以下功能,解决方法:
文件--另存为--这台电脑--桌面--保存类型(T):Excel启用宏的工作簿(*.xlsm)