平时做表用的OFFICE的Excel
1 打开vbe编辑器
具体操作过程见我关于Excel利用VBA实现去掉单元格两边空格的方法。
2 双击左侧thisworkbook标签,并粘贴代码
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)Cells.FormatConditions.DeleteWith Target.EntireColumn.FormatConditions.Add xlExpression, , "=true".FormatConditions(1).Interior.Color = RGB(100, 255, 255)End WithWith Target.EntireRow.FormatConditions.Add xlExpression, , "=true".FormatConditions(2).Interior.Color = RGB(100, 255, 255)End WithEnd Sub
3 查看效果