I have a large Excel workbook that imports data from some local SQL servers via Power Query and performs a bunch of calculations on the imported data in an Excel Table. Because the table containing calculations is large the workbook size is almost 100mb, with the imported data being only 6-7mb.
Strangely, I have discovered that after refreshing the links to external data and saving the file, a macro to simply hide/unhide columns in the calculations table is very slow every time and takes 2.5 mins simply to unhide columns! However, when I save, close and reopen the file and run the same macro the hide/unhide is instantaneous every time.
Below is a copy of the (very simple) macro to unhide the columns:
Application.ScreenUpdating = False
Application.Calculation = xlManual
Columns("M:LH").Hidden = False
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
I would obviously prefer not to be constantly closing and reopening the workbook. Does anyone know why the macro might be performing so slowly after the source data is refreshed and how I can make it work instantaneously without having to close/reopen every time ?
Any insight anyone can give is appreciated.
Application.Calculation = xlAutomaticneccessarily triggers a recalculation