Hi, I am trying to count all the Disagrees in a column (Disagree 1 to Disagree 10) with the below code, but it does not work. Is there another wildcard that may work, or don't wildcards work.
If not, how can I make the code count all the Disagrees, cheers.
Code
Private Sub WindowsDIS()
Dim x, y, Rws, ContAreas, i As Long, ii As Long
Const Category As String = "YES"
Const Status As String = "Disagree*" 'wildcard "Disagree*" does not count Disagree 2, Disagree 3 etc %%%%%%%%%%%%%%%%%%%%%
Rws = Array(1, 2, 3)
ContAreas = Array("SECA14", "SECA15", "SECA16")
x = ActiveSheet.[a24].CurrentRegion
ReDim y(1 To 3, 1 To 1)
For i = 2 To UBound(x, 1)
If x(i, 2) = Category And x(i, 11) = Status Then
'2 is YES, col 2 11 is Disagree* (0 1 2 3), col 7
For ii = LBound(ContAreas) To UBound(ContAreas)
If ContAreas(ii) = x(i, 1) Then y(Rws(ii), 1) = y(Rws(ii), 1) + 1 '1 is Area, col 1
Next
End If
Next
With ActiveSheet
.[f8].Resize(3) = y
.Activate
End With
End Sub
Display More