陈述正确的问题
Application.WorksheetFunction.CountIf(Range("B:B-B5"), a)
我想选择减去VBA中整个单元格的整个列。 我该怎么办?
答案 0 :(得分:1)
您可以为此编写一个辅助函数:
Function CountIfExcept(from As range, except As range, criteria As String)
CountIfExcept = Application.WorksheetFunction.CountIf(from, criteria) - Application.WorksheetFunction.CountIf(except, criteria)
End Function
用法:
totalCount = CountIfExcept(Range("B:B"), RANGE("B5"), "some condition")