Compile error: do without loop
<p>I understand that most often, this error occurs when there's an unterminated if but I can't seem to find it. I'm a complete beginner to Excel VBA so please bear with me. Here's my code. Basically, the gist of this macro is to read the selected pairing of values in a9 and b9 and then search through a list of results until it corresponds with the values in a9 and b9 to then add 1 to a column on that specific row.</p>

<pre><code>Dim z As Integer
z = 42
'If selected adc = adc in row z
' Then if selected sp = sp in row z
'Add 1 to win column in row z

If [a9] = [g[z]] Then
  If [b9] = [h[z]] Then
    [i[z]] = [i[z]] + 1
  End If

  'Elseif selected adc =/= adc in row z
  'Then add 1 to row
  'Do until selected adc = adc in row z

ElseIf [a9] &lt;&gt; [g[z]] Then
  z = z + 1
  Do Until [a9].Text = [g[z]].Text
    Exit Do

    'If selected sp = sp in row z
    'Then add 1 to column h (win column) in row z

    If [b9] = [h[z]] Then
      [i[z]] = [i[z]] + 1
    End If

    'If selected sp =/= sp in row z
    'Then add 1 to row
    'Do until selected sp = sp in row z

    If [b9] &lt;&gt; [h[z]] Then
      z = z + 1
      Do Until [b9].Text = [h[z]].Text
        Exit Do
        If [b9] = [h[z]] Then
          [i[z]] = [i[z]] + 1
        End If    
</code></pre>