How to delete all constraints from solver in Excel?
I can use SolverDelete
to delete a constraint if I know exactly what it looks like.
How can I delete all constr开发者_JAVA技巧aints with VBA without knowing them?
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.
SolverReset works if you don´t know all the parameters.
精彩评论