I have a very strange problem. I have a large Excel data set (100k+ rows) with an autofilter. The autofilter runs fine on the main sheet, but after running some code (does multiple calculations and then hard codes the values) the autofilter then runs very slow. Every time I change or clear a filter (previously took 1 second, now takes 10+ seconds).
The only change is the values in the table from running the code. I’ve done all the standard stuff:
-
All the values are hard coded (i.e. no formulas in the data) and
there are no formulas referencing the data. -
There are no excess lines at the end of the data.
-
I have all the standard code at the start and end of the VBA code (see below).
-
I tried saving the file to see if there was some temp cache data that would clear when saving.
-
There is no conditional formatting or any other formatting in the table.
Additional context (Office 365, and the file is on One Drive, autosave is turned off). If anyone has any ideas it will be greatly appreciated.Sub ValueChange() Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Application.EnableEvents = False 'Sample of Code With ws2.Range("V34:Y" & RowCount) .Formula = "=Round(Staging!A34-IFERROR((1/Main!$Z34-1/Main!$FD34),0),2)" 'write formula to all cells .value = .value 'replace formula by values End With Application.CutCopyMode = False Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True Application.EnableEvents = True End Sub