Intermedius
New Member
- Joined
- Oct 12, 2012
- Messages
- 32
Hello,
I have an array formula being inserted into an Excel Data table column via VBA statement, which then processes 100's & sometimes 1000's of lines that are taking too long for My laptop to process in a feasible amount of time.
I have chosen VBA because it appears moderately faster to clear the data and existing array formula, then add the new data 1st, rather than just keeping the array formula column filled, and use table properties to remove all other data and replace with new data.
Sub ClearTableData()
'Clear Table Data
With Sheets("Sheet1").ListObjects("Data_Table")
If Not .DataBodyRange Is Nothing Then
.DataBodyRange.Delete
End If
End With
I then append new data to the existing, but cleared data table.
After the new data is appended, i re-add the Array formula:
Sub AddArrayFormula()
'Add Array Formula
With ActiveSheet.ListObjects("Data_Table").ListColumns("ArrayColumn").DataBodyRange
.ClearContents
.Cells(1).FormulaArray = "=Array Formula"
End With
It could just be in my head that it works faster, as i have not timed the process and My data sets have changed overtime. In either case, the processing time is not ideal to achieve the result needed.
I have an array formula being inserted into an Excel Data table column via VBA statement, which then processes 100's & sometimes 1000's of lines that are taking too long for My laptop to process in a feasible amount of time.
I have chosen VBA because it appears moderately faster to clear the data and existing array formula, then add the new data 1st, rather than just keeping the array formula column filled, and use table properties to remove all other data and replace with new data.
Sub ClearTableData()
'Clear Table Data
With Sheets("Sheet1").ListObjects("Data_Table")
If Not .DataBodyRange Is Nothing Then
.DataBodyRange.Delete
End If
End With
I then append new data to the existing, but cleared data table.
After the new data is appended, i re-add the Array formula:
Sub AddArrayFormula()
'Add Array Formula
With ActiveSheet.ListObjects("Data_Table").ListColumns("ArrayColumn").DataBodyRange
.ClearContents
.Cells(1).FormulaArray = "=Array Formula"
End With
It could just be in my head that it works faster, as i have not timed the process and My data sets have changed overtime. In either case, the processing time is not ideal to achieve the result needed.
Last edited: