I would like to create a function which loops over certain cell values. If the value contains an "X", the count should increase by 1.
The syntax should be something like this:
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
But I cant get this working. Any thoughts on how I can achieve my goal?