Private Sub CommandButton2_Click()
'Modified 8/30/2018 7:36:35 PM EDT
Dim ans As Long
With ActiveSheet.ListObjects("npss_quote").DataBodyRange
ans = .Rows.Count
If ans > 1 Then .Rows(ans).Delete
End With
End Sub
OK. Just ask a mod to help. cheersI made a mistake then couldn't delete it
Private Sub CommandButton2_Click()
'Modified 8/30/2018 8:21:30 PM EDT
Dim ans As Long
With ActiveSheet.ListObjects("npss_quote").DataBodyRange
ans = .Rows.Count
If ans > 1 Then .Rows(ans).Delete
If ans = 1 Then .Rows(1).ClearContents
End With
End Sub
If you want to clear contents of Row(1) after all other rows are deleted
Try this:
Code:Private Sub CommandButton2_Click() 'Modified 8/30/2018 8:21:30 PM EDT Dim ans As Long With ActiveSheet.ListObjects("npss_quote").DataBodyRange ans = .Rows.Count If ans > 1 Then .Rows(ans).Delete If ans = 1 Then .Rows(1).ClearContents End With End Sub
Private Sub CommandButton2_Click()
'Modified 8/30/2018 9:24:30 PM EDT
Dim ans As Long
With ActiveSheet.ListObjects("npss_quote").DataBodyRange
ans = .Rows.Count
If ans > 1 Then .Rows(ans).Delete
If ans = 1 Then .Rows(1).Cells.SpecialCells(xlCellTypeConstants).ClearContents
End With
End Sub