I am needing to Delete the rows of multiple tables in a file (leaving the Formulas intact), but I need tables on a few tabs to remain completely intact. When I use the following macro, it works if I cite One exception, but if I add an Or statement, it ignores the tabs listed after Or and only protects the first Tab listed.
The Code Is:
>>> use code - tags <<<
The Sample File I have attached only has four tab (there are Many in the original, but I need to skip 3 of them for this macro). There are more tabs to delete data from than tabs to leave intact. Most tabs in the original file only have the one table on them, but the last tab has Multiple tables on them. My example only has one table per tab, but I wanted to explain that, just in case.
Any thoughts on how to handle?
Thanks!
The Code Is:
>>> use code - tags <<<
Code:
Sub DeleteRows()
Dim tbl As ListObject
Dim xWs As Worksheet
On Error Resume Next
For Each xWs In ThisWorkbook.Worksheets
If xWs.Name <> "Continuous" Then
For Each tbl In xWs.ListObjects
Set tbl = ActiveSheet.ListObjects()
tbl.DataBodyRange.Rows.Delete
tbl.ShowTotals = True
Next tbl
End If
Next xWs
End Sub
Any thoughts on how to handle?
Thanks!
Attachments
Last edited by a moderator: