1、1,按ALT+F11键,弹出框
2、2,VBAProject--单击需要修改背景色的表单,复制如下代码:Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) On Error Resume Next Cells.FormatConditions.Delete iColor = 35 With Target.FormatConditions .Delete .Add xlExpression, , "TRUE" .Item(1).Interior.ColorIndex = iColor End WithEnd Sub
3、点击保存,退出。随意选定区域背景色加深了