AutoFilter如何筛选单元格背景颜色为空?
vba代码:
Sub FilterByColor()
Dim rng As Range
Dim cell As Range
Dim colorIndex As Long
Set rng = Range("A1:A100")
colorIndex = -4142
'这个colorIndex 的值是什么时可以筛选背景颜色为空的单元格?
rng.AutoFilter Field:=1, Criteria1:=colorIndex, Operator:=xlFilterCellColor
End Sub
python代码:
import win32com.client
def colorFilter(workbookName, sheetName, col, color):
try:
sheet = ConnectSheet(workbookName, sheetName)
sheet.Columns(col).AutoFilter(Field = col,Criteria1 = color, Operator = 8)
Release()
except Exception as e:
Release()
msg = '错误内容:' + str(e)
print(msg)
return msg
colorIndex 的值 -4142 ,xlNone , xlColorIndexAutomatic , xlColorIndexNone , None , Null , vbWhite.都已经试过,没有达到预期的效果.
@金山办公