1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 基于VBA实现Excel十字交叉高亮显示

基于VBA实现Excel十字交叉高亮显示

时间:2020-12-29 17:36:12

相关推荐

基于VBA实现Excel十字交叉高亮显示

平时做表用的OFFICE的Excel

1 打开vbe编辑器

具体操作过程见我关于Excel利用VBA实现去掉单元格两边空格的方法。

2 双击左侧thisworkbook标签,并粘贴代码

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)Cells.FormatConditions.DeleteWith Target.EntireColumn.FormatConditions.Add xlExpression, , "=true".FormatConditions(1).Interior.Color = RGB(100, 255, 255)End WithWith Target.EntireRow.FormatConditions.Add xlExpression, , "=true".FormatConditions(2).Interior.Color = RGB(100, 255, 255)End WithEnd Sub

3 查看效果

4.另存为xlsm格式,如果其他可能会把vba代码抹除

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。