dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,375
- Office Version
- 365
- 2016
- Platform
- Windows
I have a table and buttons to add and delete rows. It won't delete the last row of the table when there is just one row left and this is good as if it did, it would delete all the formulas from it. However, I do want to clear it of contents when it gets down to deleting the last row, but keep the formulas and data validation lists. How do I do this?
I have the following code in my delete button:
Private Sub cmdDeleteRow_Click()
Dim ans As Long
With ActiveSheet.ListObjects("npss_quote").DataBodyRange
ans = .Rows.Count
If ans > 1 Then .Rows(ans).Delete
End With
End Sub
I have the following code in my delete button:
Private Sub cmdDeleteRow_Click()
Dim ans As Long
With ActiveSheet.ListObjects("npss_quote").DataBodyRange
ans = .Rows.Count
If ans > 1 Then .Rows(ans).Delete
End With
End Sub
Last edited: