Have been trying to automatically run a solver i have set up through a macro, but after using the recorder to create the macro I am getting a "Sub or function not defined" error, with "SolverOK highlighted.
There is my code, I am trying to minimize cell O2 on Sheet "Dedicated Model", by changing A2:A201, with the constraint that A2:A201 are all different (isdif). Using an evolutionary model. Any insight on why this isnt working?
VBA Code:
Sub OptimizeDedicated()
'
' OptimizeDedicated Macro
'
'
Worksheets("Dedicated Model").Activate
SolverAdd SetCell:="$O$2", MaxMinVal:=2, ValueOf:=0, ByChange:="$A$2:$A$201", _
Engine:=3, EngineDesc:="Evolutionary"
SolverOk SetCell:="$O$2", MaxMinVal:=2, ValueOf:=0, ByChange:="$A$2:$A$201", _
Engine:=3, EngineDesc:="Evolutionary"
SolverSolve
End Sub
There is my code, I am trying to minimize cell O2 on Sheet "Dedicated Model", by changing A2:A201, with the constraint that A2:A201 are all different (isdif). Using an evolutionary model. Any insight on why this isnt working?