Hello,
I have a problem:
I have a first optimization problem with constraint set 1 where I use solver. I've saved these constraint in some cells. Now, based on this solution, I compute a second optimization problem but with an other 'objective function', 'cells to change' and 'constraint set' (set 2, which I also saved in the file).
Now all of this I want to record in a macro:
- load constraits set 1
- fill objective function 1
- fill in variables to change 1
- solve
- load constraints set 2
- fill in objective function 2
- fill in variables to change
- solve
When I'm recording this, It is working but when I want to use the macro, it fails. I think it won't recognize the 'load of constraint' but I don't knw how to solve it. Can you please? I would like it if I can solve the problem in the same sheet.
This is my code:
----------------------------------------------
Range("J2:O22").Select
Selection.ClearContents
SolverOk SetCell:="$Y$23", MaxMinVal:=1, ValueOf:=0, ByChange:="$J$2:$O$22", _
Engine:=2, EngineDesc:="Simplex LP"
SolverSolve
Range("AH2:AL22").Select
Selection.ClearContents
SolverLoad LoadArea:="$J$2:$O$22"
SolverOk SetCell:="$AF$23", MaxMinVal:=1, ValueOf:=0, ByChange:="$AH$2:$AL$22" _
, Engine:=2, EngineDesc:="Simplex LP"
SolverSolve
-------------------------------------
Bookmarks