扫码下载APP
及时接收最新考试资讯及
备考信息
1.高亮颜色标记单元格
VBA代码:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
On Error Resume Next
Cells.FormatConditions.Delete
With Target.FormatConditions
.Delete
.Add xlExpression, , "TRUE"
.Item(1).Interior.ColorIndex = Int(50 * Rnd() + 2)
End With
End Sub
2.高亮颜色标记行
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 = Int(50 * Rnd() + 2)
End With
End Sub
3.高亮颜色标记列
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
On Error Resume Next
Cells.FormatConditions.Delete
With Target.EntireColumn.FormatConditions
.Delete
.Add xlExpression, , "TRUE"
.Item(1).Interior.ColorIndex = Int(50 * Rnd() + 2)
End With
End Sub
4.高亮颜色编辑行列
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
On Error Resume Next
Cells.FormatConditions.Delete
iColor = Int(50 * Rnd() + 2)
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
上一篇:如何删除固定区域的所有图形?
下一篇:EXCEL如何实现奇偶页打印?
Copyright © 2000 - www.chinaacc.com All Rights Reserved. 北京正保会计科技有限公司 版权所有
京B2-20200959 京ICP备20012371号-7 出版物经营许可证 京公网安备 11010802044457号