title: For loop to format cells every other 5 rows
body: <p>I'm trying to format a growing table. Assuming the table has 20 rows I want the first 5 and every other 5 after that so 1-5, 11-15 to be a certain color. I tried to achieve this with a for loop. </p>
  
  <pre><code>b = 0
  For i = 1 To lRow
      a = i - (5 * (i \ 5))
      c = b - (2 * (b \ 2))
      If c = 0 Then
          If a = 0 Then
              DSws.Range("A" &amp; i - 3, "H" &amp; i). _
              Interior.Color = RGB(141, 180, 227)
              b = b + 1
              MsgBox b
          End If
      End If
  
  Next I
  </code></pre>
  
  <p>lRow determines the last row and therefore sets the range for the loop.</p>
  
  <p>After that I use two mod functions, the first to determine that it is an interval of 5, and the second to determine if the iteration is even or odd (to accomplish the other 5 effect).</p>
  
  <p>When I run this code only the first 5 are highlighted. </p>