I try to delete all the rows in my table. I would be preferable not to delete the entire row, but only the in the table, but I guess it's not possible. When I use the code below it does what it should but ends with an error "Run-time error '1004': Application-defined or object-defined error"
I have tried MsgBox objRow.Range.EntireRow.Address, and all the rows is actually in the table.
What could be the problem? Does Excel not have some kind of a truncate table function?
Code:
For Each objRow In ActiveSheet.ListObjects("Table1").ListRows
objRow.Range.EntireRow.Delete
Next
I have tried MsgBox objRow.Range.EntireRow.Address, and all the rows is actually in the table.
What could be the problem? Does Excel not have some kind of a truncate table function?