I have a large set of data that
I want to sort on 4 criteria, 188,610 rows to be exact (and 7 columns). Manually it works without problems. It also works in Excel 2010 with VBA. However, it doesn't work in Excel 2013.
In 2013, the macro blocks on the
'Apply' statement:"run-time error '1004': application-defined or object-defined error". If I reduce the nr of records to 131,000 it works ... Is this a known bug?
I can send you a test file if you like (can't attach it on this forum).
Below my code:
Dim sht As Worksheet Set sht = ThisWorkbook.Sheets("Csh_Bal") sht.ListObjects.Add(xlSrcRange, sht.Range("A1:G" & sht.[A1000000].End(xlUp).row), , xlYes).Name = _"Table1" With sht.ListObjects("Table1").Sort .SortFields.Clear .SortFields.Add Key:=Range("Table1[Date]"), SortOn:=xlSortOnValues, Order:=xlAscending .SortFields.Add Key:=Range("Table1[Country Code]"), SortOn:=xlSortOnValues, Order:=xlAscending .SortFields.Add Key:=Range("Table1[Rating]"), SortOn:=xlSortOnValues, Order:=xlAscending .SortFields.Add Key:=Range("Table1[Segment]"), SortOn:=xlSortOnValues, Order:=xlAscending .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With