dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,352
- Office Version
- 365
- 2016
- Platform
- Windows
Is there a way to speed up this code, possibly with arrays or something else?
VBA Code:
Sub cmdDeleteAllQuoteLines()
'Deleting The Data In A Table
Dim tbl As ListObject
Dim cell As Range
Set tbl = Sheets("CSS_quote_sheet").ListObjects("CSS_quote")
'Delete all table rows except first row
With tbl.DataBodyRange
If .Rows.Count > 1 Then
.Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count).Rows.Delete
End If
'Clear the contents, but not delete the formulas
For Each cell In tbl.ListRows(1).Range.Cells
If Not cell.HasFormula Then
cell.Value = ""
End If
Next
End With
Call InsertFormulas
'ListObjects("CSS_quote").ListColumns("10%Increase").DataBodyRange.Value = "1"
End Sub