I have a table tbl
which is a ListObject
. I want to delete rows that only have empty values or equations.
Dim tbl As ListObject
Set tbl = sh.ListObjects(1)
Dim r As ListRow
Dim c As Range
Dim d As Integer
For Each r In tbl.ListRows
d = 1
For Each c In r.Range.Cells
If IsEmpty(c) = False And c.HasFormula = False Then
d = 0
End If
Next
If d = 1 Then
Debug.Print "DELETE", r.Index
'''' rows(r.Index).EntireRow.Delete
End If
Next
This works until I uncomment the commented line which deletes the row.
Probably some objects get messed up upon deletion, because error says:
Application defined or object defined error.