Using Solver in a Macro

  • Thread starter Thread starter Scot
  • Start date Start date
S

Scot

I have created a spreadsheet that does a series of calculations. One of the
calculations requires the use of the Solver. The solver refers to a value
in a cell on the spreadsheet. I created a macro to run the series of
calculations, but it gets stuck on the solver apparently at the point it
needs the value from a cell. My question is: How can I get the macro to
perform the solver function and keep going?

Scot
 
You need to set a reference to Solver in order to get it to work initially, eg
within the VBE do Tools / references / Check the 'Solver' option.

When you record the code to go into your macro you will have a line that looks
like this at the end

SolverSolve

If you want it to automatically populate the cell with the value without the
user having to OK it, then you need to manually add (True):-

SolverSolve (True)
 
Back
Top