views:

37

answers:

2

I can use SolverDelete to delete a constraint if I know exactly what it looks like.

How can I delete all constraints with VBA without knowing them?

+2  A: 

You can use the SolverGet Function.

SolverGet(TypeNum, SheetName)

TypeNum is a required Integer. A number specifying the type of information you want. The following settings are specified in the Solver Parameters dialog box.

The TypeNum parameters you need are:

5, The number of constraints.
6, An array of the left sides of the constraints, in text form.
7, An array of numbers corresponding to the relationships between the left and right sides of the constraints: 1 represents <=, 2 represents =, 3 represents >=, 4 represents int, and 5 represents bin.
8, An array of the right sides of the constraints, in text form.

See Excel Help on SolverGet for more details.

Lance Roberts
bravo very nice answer
I__
+1  A: 

SolverReset works if you don´t know all the parameters.

Ibhar