怎样使用VBA在已有条件格式区域增加条件?
1、首先在开发工具中打开VBA编辑器

2、在单元格区域当中输入一些内容作为例子

3、在VBA编辑器中插入模块

4、在模块当中输入如下代码,然后运行
Sub 新增一个条件格式()
With Selection
.FormatConditions.Add Type:=xlExpression, Formula1:="=OFFSET
(A3,0,5)=""差"""
.FormatConditions(.FormatConditions.Count).SetFirstPriority
With .FormatConditions(1).Interior
.PatternColorIndex=xlAutomatic
.ColorIndex=3
.TintAndShade=0
End With
End With
End Sub

5、使用快捷键Alt+F8调出运行宏窗口,然后单击“执行”按钮

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:187
阅读量:92
阅读量:159
阅读量:91
阅读量:40