I have a code that needs to analyze a very large amount of data that has new data added regularly, and as such, the array size increases each week. The codes overall purpose is to compare the new data, to the previous weeks data and do some analysis of those items.
It has been working fine for weeks, but this week I am getting an overflow error when I try to assign the array from the excel sheet range. I tried running the same code on last weeks array, which is slightly smaller, and it still works fine. It seems that the reason for the overflow, is because there is more data this week.
Last weeks array had about 1.16 million elements, and the assignment worked fine. This week, the array has about 1.28 million elements, and I get an overflow error.
Below is a small snippet of the code. The line that causes the error is the line where oldArr is assigned. Note that oldArr is not declared prior to this line. I have tried assigning it with a "DIM" statement, but that did not change the result. I assume this is a data size issue, but according to some searching, VBA has had no limit on array size for many years.
The code works on last weeks data, where lastRow_old = 10734. However, this week it equals 11847, and now I get an overflow. Why am I getting this error now and how can I fix it?
Dim oldWS As Worksheet
Set oldWS = ThisWorkbook.ActiveSheet
firstRow = 3
lastRow_old = oldWS.Cells(Rows.Count, 4).End(xlUp).Row
oldArr = oldWS.Range("A" & firstRow & ":EE" & lastRow_old)