title: How to insert a variable in a countif formula in VBA?
body: <p>I’m trying to do a <code>COUNTIF</code> function, using <code>mcol</code> and <code>mrow</code> as variables.
  It perfectly works,the problem appears as far I need to increase each time <code>mrow</code> value by 1, but the row range R[] in <code>=COUNTIF(Analysis!RC[9]:R[8]C[9],""&lt;=3"")</code> to increase each time by 9.</p>
  
  <p>I was thinking to punt into <code>COUNTIF</code> another variable <code>i</code> and into <code>for</code> to put <code>i = i + 9</code>, but I’m not sure how to fix it.
  Could anyone help with it, please?</p>
  
  <pre><code>Sub Test()
      Set wb = Workbooks("Book1.xlsm")
      Application.ScreenUpdating = False
  
      LastRow0 = Sheets("Tests").Range("A" &amp; Sheets("Tests").Rows.Count).End(xlUp).Row
  
      mcol = 3
  
      For mrow = 2 To LastRow0
          Cells(mrow, mcol + 1) = "=COUNTIF(Analysis!RC[9]:R[8]C[9],""&lt;=3"")"
          Cells(mrow, mcol + 2) = "=COUNTIF(Analysis!RC[9]:R[8]C[9],""good"")"
      Next mrow
  
  End Sub
  </code></pre>