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 WithEnd Sub
5、使用快捷键Alt+F8调出运行宏窗口,然后单击“执行”按钮