Excel VBA - Looping a ListObject Column
<p>Evening SO,</p>

<p>I'm trying to loop through a specific column in a listobject table.  I have executed this and it works perfectly EXCEPT if the column is empty (i.e. table has no rows).  This would be very rare but naturally the master copy of this workbook would be blank and therefore returns an Error 91 for a null object.</p>

<p>How can I make the code execute even if the table is empty without returning an error 91?  I know I can use On Error Resume Next, but that's like taking pain killers, it doesn't address the problem.</p>

<pre><code>For Each cell In Worksheets(3).ListObjects("tblTableName").ListColumns(2).DataBodyRange.Cells
  'Do some stuff here
Next
</code></pre>

<p>The above code executes fine if the table contains data but throws an Error 91 if the table is blank as it will always be in the master copy.</p>