yczcc

 转载需注明来源:https://www.cnblogs.com/yczcc/p/7976620.html 

excel 高亮 单元格 选中单元格

“工作表”右键,“查看代码”,

 VBA代码编辑器中,选择“Worksheet”

在Worksheet_SelectionChange函数中添加如下代码:

Target.Parent.Cells.Interior.ColorIndex = xlNone
Target.EntireColumn.Interior.ColorIndex = 36
Target.EntireRow.Interior.ColorIndex = 36

最后整个函数如下:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Target.Parent.Cells.Interior.ColorIndex = xlNone
    Target.EntireColumn.Interior.ColorIndex = 36
    Target.EntireRow.Interior.ColorIndex = 36
End Sub

保存,关闭即可。

效果:

 转载需注明来源:https://www.cnblogs.com/yczcc/p/7976620.html 

分类:

技术点:

相关文章:

  • 2021-10-03
  • 2021-04-28
  • 2021-04-01
  • 2021-07-10
  • 2021-05-09
  • 2021-11-11
猜你喜欢
  • 2021-12-05
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2021-12-22
相关资源
相似解决方案