EXCEL防止看错行列VBA代码

 时间:2026-02-14 20:21:07

1、打开需要使用防止看错行的工作薄,选中工作表标签,单击鼠标右键,选择“查看代码”进入到VBA工程窗口。

EXCEL防止看错行列VBA代码

EXCEL防止看错行列VBA代码

2、将代码复制到需要使用的工作表的代码窗口。

EXCEL防止看错行列VBA代码

3、代码:

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 = 24   

    End With

    With Target.EntireColumn.FormatConditions

        .Delete

        .Add xlExpression, , "TRUE"

        .Item(1).Interior.ColorIndex = 24   

    End With

    Selection.FormatConditions.Delete

End Sub

效果如图:

EXCEL防止看错行列VBA代码

  • 在EXCEL如何避免看错行
  • Excel名称管理器使用技巧的详细讲解
  • Excel2019如何开启用智能鼠标缩放
  • excel2019怎么样快速高亮显示选中的行和列
  • Excel 2016如何在名称中使用合并区域引用
  • 热门搜索
    记忆力减退怎么办 屏幕保护程序怎么设置 肩宽怎么测量 癫痫病是怎么引起的 怎么缩小鼻孔 新闻报道怎么写 婴儿黄疸怎么办 海蓝之谜怎么样 怎么清理磁盘 卡拉赞怎么去