Excel VBA使用Rangeselect整个工作表
我正在使用下面的代码来search表单来查找单词“example”出现多less次。
count = Application.WorksheetFunction.CountIf(Range("A1:A10"), "example")
我似乎无法弄清楚如何使用Range函数遍历整个工作表。
尝试在下面查找整个表单中的string“示例”。
Count = Application.WorksheetFunction.CountIf(Cells, "example")
使用通配符
Count = Application.WorksheetFunction.CountIf(Cells, "*example*")
为什么你需要迭代整个表单? 你可以改变扩展范围?
A1:A10
count = Application.WorksheetFunction.CountIf(Range("A1:A10"), "example")
A1:E10
count = Application.WorksheetFunction.CountIf(Range("A1:E10"), "example")
整张纸
count = Application.WorksheetFunction.CountIf(ActiveSheet.Cells, "example")