In trying to help address this question, I came across some very strange behavior from Solver in VBA.
I am wondering if anyone else can reproduce it
I just ran your code in Excel 2010 and got the same results. If anything, it is worse in that I get the bug whether or not SolverReset
is called and, furthermore, after running the code the text "Setting Up Problem..." lingers in the status bar on the bottom of Excel
It makes perfect sense that the Solver needs to set calculation to manual with GRG Nonlinear
since it is going to be evaluating the objective function by changing cells in the worksheet and wouldn't want to evaluate them until the correct input values are in place. When called from the Excel interface, the Solver cleans up after itself. Whoever put together the VBA interface must have forgotten this little detail. Its clearly a bug. Perhaps you could file a bug report at Solver.com (the website of Frontline Systems, who make the solver for Microsoft) .The workaround is of course easy enough: just put the line
Application.Calculation = xlCalculationAutomatic
at the bottom of the sub.