我想创建一个循环某些单元格值的函数。如果值包含"X"
,则计数应增加1。
语法应该是这样的:
Sub CountVars()
Dim range As Variant
Dim ranges As Variant
Dim count as Integer
'set array with ranges
range = Array("c3", "f3", h3)
For Each range In ranges
count = 0
'if range = "X" then
count = count + 1
End If
Next
但我不能让这个工作。关于如何实现目标的任何想法?