PDA

View Full Version : Solved: Issue with running Solver in VBA



haddy27
04-24-2007, 07:52 AM
I am writing a macro that uses the Solver add in in Excel.

I can get the Solver to work fine, although once it has run I get an 'Solver Results Box', where you can choose to keep the results from the Solver or restore original values.

I can't work out how I can automate the response to this to click OK each time this box appears to save doing it for every record.

The code I have already to run the Solver is:


Sheets("Iain1").Select
SolverOk SetCell:="$I$13", MaxMinVal:=3, ValueOf:="0", ByChange:="$I$6"
SolverSolve


Any help would be appreciated!

haddy27

JonPeltier
04-27-2007, 09:33 AM
From Excel VBA help file:


SolverSolve(UserFinish, ShowRef)

UserFinish Optional Variant. True to return the results without displaying the Solver Results dialog box. False or omitted to return the results and display the Solver Results dialog box.