① 条件格式中包含多个文本怎么设置
把你要设置该条件格式的文件都放在一个目录,然后在该目录下新建一个工作薄,并打开,按ALT+F11打开VBA编辑器,,在左边列表栏点击鼠标右键插入一个模块,粘贴以下代码到右边窗口,
保存然后执行该代码. 这个目录下所有excel文件的第一个表格都会按你的要求设置了条件格式
注意:文件为excel 2003版扩展名是xls,
代码如下:
SubMacro1()
DimFileNameAsString
DimWBAsWorkbook
FileName=Dir(ThisWorkbook.Path&"*.xls")
IfFileName<>""Then
Do
IfFileName<>ThisWorkbook.NameThen
SetWB=Workbooks.Open(ThisWorkbook.Path&""&FileName)
WithWB.Sheets(1)
Fori=0To21
str1="="&Range("e1").Offset(0,i).Address
str2="="&Range("e2").Offset(0,i).Address
With.Range("E3:E3000").Offset(0,i)
.FormatConditions.Delete
.FormatConditions.AddType:=xlCellValue,Operator:=xlNotBetween,Formula1:=str1,Formula2:=str2
.FormatConditions(1).Interior.ColorIndex=3
EndWith
Next
EndWith
WB.Save
WB.Close
EndIf
FileName=Dir
LoopWhileFileName<>""
EndIf
EndSub