I have written a very simple solver code (see below) that runs fine in Excel 2007 but fails to give me a solution in Excel 2000. I can cycle through the code using F8 in the VB editor and there doesn't seem to be any errors. When I check the solver manually the constraint has been added (i.e. C4 must equal 1) but the target and reference cells have not been recorded.
I'm stumped! Can anybody help?
Sub Macro1()
AddIns("Solver Add-in").Installed = True
Application.Run "Solver.xla!SolverReset"
Application.Run "Solver.xla!SolverAdd", "$C$4", 2, "1"
Application.Run "Solver.xla!SolverOK", "$B$4", 3, "0.5", "$A$1:$A$2"
Application.Run "Solver.xla!SolverSave", "$B$1:$B$2"
Application.Run "Solver.xla!SolverSolve", True
Application.Run "Solver.xla!SolverFinish", 1
End Sub
Sean
I'm stumped! Can anybody help?
Sub Macro1()
AddIns("Solver Add-in").Installed = True
Application.Run "Solver.xla!SolverReset"
Application.Run "Solver.xla!SolverAdd", "$C$4", 2, "1"
Application.Run "Solver.xla!SolverOK", "$B$4", 3, "0.5", "$A$1:$A$2"
Application.Run "Solver.xla!SolverSave", "$B$1:$B$2"
Application.Run "Solver.xla!SolverSolve", True
Application.Run "Solver.xla!SolverFinish", 1
End Sub
Sean