I ran into an edge case in one of my spreadsheets recently. I have a loop going over all visible cells in a table:
For Each c In ws.ListObjects(1).ListColumns(1).DataBodyRange.SpecialCells(xlCellTypeVisible)
...
Next c
Normally there will always be a few items visible, but in an edge case none were, which generated an error in my code:
Run-time error '1004': No cells were found
I tried wrapping the for-loop in an if-statement
If ws.ListObjects(1).ListColumns(1).DataBodyRange.SpecialCells(xlCellTypeVisible).Count > 0 Then
But this generates the same error. Similarly if I check if the range is nothing.
How do I go about checking if there are visible cells in the filtered table?