I am trying write a CountIF formula that uses a dynamic criteria to count from a fixed range. Below is the code I was trying to make work:
Dim Flow As String
j = 5
For i = 1 To 13
Flow = Cells(2, j)
Cells(6, j).Formula = "=COUNTIF($E50:$E100,Flow)"
j = j + 2
Next i
The results pastes =COUNTIF($E50:$E100,Flow)
in the targeted cells instead of =Countif($E50:$E100,E2)
, =Countif($E50:$E100,G2)
, and so on.