1、打开需要使用防止看错行的工作薄,选中工作表标签,单击鼠标右键,选择“查看代码”进入到VBA工程窗口。
2、将代码复制到需要使用的工作表的代码窗口。
3、代码:Private Sub Worksheet_SelectionChange(ByVal Tar爿讥旌护get As Excel.Range) On Error Resume Next Cells.FormatConditions.Delete 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 = 24 End With Selection.FormatConditions.DeleteEnd Sub效果如图: