I have a huge sheet that imports external data from a server, it has 10,000+ rows and I have added more than 100 columns of calculations. I am using Solver to get min value of LSE of a nonlinear equation vs. every row. I am not sure if it is beyond the VBA capability or not ?
The run kills my machine, even with using the 4 processors of core i7. I tried to disable the following items for quicker run using two pieces of code before and after my main Solver code (attached below), but with no success:
1. Screen Updating
2. Displaying Page Breaks
3. Calculation Modes
It still takes ages to just do tens of rows, and many times it exceeds the time limit. Any advice on that excercise?
Thank you!
-------------------------------------------
Public CalcState As Long
Public EventState As Boolean
Public PageBreakState As Boolean
Sub OptimizeCode_Begin()
Application.ScreenUpdating = False
EventState = Application.EnableEvents
Application.EnableEvents = False
CalcState = Application.Calculation
Application.Calculation = xlCalculationManual
PageBreakState = ActiveSheet.DisplayPageBreaks
ActiveSheet.DisplayPageBreaks = False
End Sub
--------------------------------------------------------------------------
Sub OptimizeCode_End()
ActiveSheet.DisplayPageBreaks = PageBreakState
Application.Calculation = CalcState
Application.EnableEvents = EventState
Application.ScreenUpdating = True
End Sub
--------------------------------------------------------------------------
Solved by O. W. in 17 mins