excel鼠标定位颜色设置方法

excel鼠标定位颜色设置方法

Excel中实现鼠标用不同颜色定位表格的操作步骤如下:

1、打开需要设置的Excel表格,右键点击工作表,在弹出的菜单中点击“查看代码

Image

2、进入代码编辑窗口;

Image

3、在指定区域粘贴代码(文章末附代码);

Image

4、代码

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    On Error Resume Next
    Cells.FormatConditions.Delete
    iColor = 34
    With Target.EntireRow.FormatConditions
        .Delete
        .Add xlExpression, , "TRUE"
        .Item(1).Interior.ColorIndex = iColor
        End With
        With Target.EntireColumn.FormatConditions
            .Delete
            .Add xlExpression, , "TRUE"
            .Item(1).Interior.ColorIndex = iColor
        End With
    End Sub


回复列表



回复操作

正在加载验证码......

请先拖动验证码到相应位置

发布时间:2021-01-26 08:38:50

修改时间:2021-04-18 15:00:07

查看次数:11449

评论次数:1