Hello There,
I have a Table and doing a process where it first deletes the rows and then based on the total rows of the new data to be inserted, create blank nth total rows in the same table.
In this case the total number of rows of data is 2774.
The below code deleted the rows except for the 1st row. This table has 22 columns having formulas. It takes approximate 60 seconds for both Delete and Create Blank rows in the table. The calculation mode is set to Manual in the start of the process.
There can be more than 10,000 rows.
Could you please advise how this can be made much faster?
Look forward to hearing from you.
Thanks & regards,
Don
I have a Table and doing a process where it first deletes the rows and then based on the total rows of the new data to be inserted, create blank nth total rows in the same table.
In this case the total number of rows of data is 2774.
The below code deleted the rows except for the 1st row. This table has 22 columns having formulas. It takes approximate 60 seconds for both Delete and Create Blank rows in the table. The calculation mode is set to Manual in the start of the process.
Code:
..
Public wsFinal As Worksheet, tbl2 As ListObject
.....
'Code for Delete rows
Sub DeleteTableRows2()
On Error Resume Next
'Delete all table rows except first row from table2
With tbl2.DataBodyRange
If .Rows.Count > 1 Then
.Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count).Rows.Delete
End If
End With
'tbl2.DataBodyRange.RowHeight = 15
wsFinal.Calculate
End Sub
'Code for Creating Blank rows
'CountClipboardRows is the total number of rows (eg. 2774)
Sub CreateRowsTable2()
Set rng = Range("Table2[#All]").Resize(tbl2.Range.Rows.Count + CountClipboardRows, tbl2.Range.Columns.Count)
tbl2.Resize rng
'tbl2.Resize Range(Cells(1, 1), Cells(CountClipboardRows, tbl2.DataBodyRange.Columns.Count))
End Sub
There can be more than 10,000 rows.
Could you please advise how this can be made much faster?
Look forward to hearing from you.
Thanks & regards,
Don