czwartek, 21 stycznia 2016

VBA: cleaning data from ListobjectTable without destroying it.

I highly recommend:
http://stackoverflow.com/questions/10220906/how-to-select-clear-table-contents-without-destroying-the-table Version improved for my needs checks if data has not been cleaned already:
    With .ListObjects("Table3")

        .Range.AutoFilter
            If .DataBodyRange.Rows.Count > 1 Then
            .DataBodyRange.Offset(1).Resize(.DataBodyRange.Rows.Count - 1, .DataBodyRange.Columns.Count).Rows.Delete
            End If
        .DataBodyRange.Rows(1).Cells.ClearContents
        
    End With

Brak komentarzy:

Prześlij komentarz