1、右键单击工作表(左下方工作表名称),选择查看代码。
2、写入以下内容,即可改变单元格颜色
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Target.Interior.Color = vbYellow
End Sub
3.1、写入以下内容,即可改变整行颜色
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If i = 0 Then i = 1
Rows(i).Interior.Pattern = xlNone
i = Target.Row
Rows(i).Interior.Color = vbYellow
End Sub
3.2、写入以下内容,即可改变整列颜色
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If i = 0 Then i = 1
Rows(i).Interior.Pattern = xlNone
i = Target.Row
Selection.EntireColumn.Interior.Color = vbYellow
End Sub
3.3、整行变色继续单击变色移动
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Rows().Interior.ColorIndex = 0
x = ActiveCell.Row
Rows(x).Interior.ColorIndex = 9
End Sub
本文来源:https://www.wddqw.com/doc/6a03a43303020740be1e650e52ea551810a6c905.html
正在阅读:
会计信息化:概念、特征和意义01-01
赞美劳动者的诗句01-01
【五一劳动节手抄报内容资料】五一劳动节手抄报资料:古诗中的劳动01-01
关于青春活力的名言佳句01-01
班长竞选演讲稿01-01
2020法制教育学习心得体会范文01-01
查新咨询单位01-01
古诗小隐自题翻译赏析01-01