title: ListObject Table Row Count
body: <p>I have an excel table with one header row and one data body row. I want to count the data body rows. When I'm trying to check how many rows my table has with</p>
  
  <pre><code>Set myWorkSheet= ActiveWorkbook.Worksheets("Sheet1")
  Set myTable= myWorkSheet.ListObjects("Table1")
  countrows = myTable.ListRows.Count
  </code></pre>
  
  <p><code>countrows</code> contains <code>0</code>. If the has 2 or more rows, it gives the right row number. Why does it say 0 for one row ans is it the best way to count the rows or are there better ones?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Found out whats causing the problem. I use this lines to clear the table before i fill it again:</p>
  
  <pre><code>If tblChart.ListRows.Count &gt;= 1 Then
      myTable.DataBodyRange.Delete
  End If
  </code></pre>
  
  <p>After that operation the table looks like I described it. Without it and modifying the table to look like I described the table it worked. But why is it causing this problem?</p>