title: Assistance needed on the following error: "Invalid Next Control Variable Reference"
body: <p>I am currently writing code in VBA which will pull information from Oddschecker. Having inspected the relevant site, I can see the following:</p>
  
  <pre><code>&lt;table class = "eventTable"....&gt;
  
      &lt;tbody id ="t1"....&gt;
  
           &lt;tr data-bname="Competitor A", data-hcap-sort="1"
  </code></pre>
  
  <p>I am trying to capture Competitor A's name, as well as their ranking (as displayed under data-hcap-sort).</p>
  
  <p>However, I am encountering the following error message:</p>
  
  <p><strong>Runtime error 13.Type Mismatch</strong></p>
  
  <p>I'm not sure if I am using the incorrect tags/variables, or, whether there is something basic I am overlooking.</p>
  
  <pre><code>Option Explicit
  
  Sub ProcessHTMLPage(HTMLPage As MSHTML.HTMLDocument)
  
      Dim HTMLTable As MSHTML.IHTMLElement
      Dim HTMLTables As MSHTML.IHTMLElementCollection
      Dim HTMLRow As MSHTML.IHTMLElement
      Dim HTMLHCap As MSHTML.IHTMLElement
  
      Set HTMLTables = HTMLPage.getElementById("t1")
  
      For Each HTMLTable In HTMLTables
          Debug.Print HTMLTables
  
      For Each HTMLRow In HTMLTables.getElementsByTagName("data-bname")
          Debug.Print HTMLRow.innerText
      Next HTMLRow
  
      For Each HTMLHCap In HTMLTables.getElementsByTagName("data-hcap-sort")
          Debug.Print HTMLHCap.innerText
      Next HTMLHCap
  
   End Sub
  </code></pre>
  
  <p>Thank you in advance for any assistance in advance. A novice with VBA, so please excuse my ignorance.</p>