1

I'm trying to solve a problem with the following code but I just can't find a way around it. Whenever I try the Macro, I get an error "Sub or Function not defined". and the debugger highlights in yellow "Sub Solver_Overtime() and highlights in blue "SolverRest"

Sub Solver_OverTime()
Application.ScreenUpdating = False
Sheets("OverTime").Activate
SolverReset
SolverOptions MaxTime:=100, _
    Iterations:=100, _
    Precision:=0.000001, _
    AssumeLinear:=True, _
    StepThru:=False, _
    Estimates:=1, _
    Derivatives:=1, _
    SearchOption:=1, _
    IntTolerance:=5, _
    Scaling:=False, _
    Convergence:=0.0001, _
    AssumeNonNeg:=True
SolverAdd CellRef:="NET", Relation:=3, FormulaText:="NET_LIMIT"
SolverAdd CellRef:="shftCount", Relation:=1, FormulaText:="shftCountLimit"
SolverAdd CellRef:="schTemplate", Relation:=4, FormulaText:="integer"

SolverOk setcell:=Sheets("OverTime").Range("Intervals[[#Totals],[OT]]"), MaxMinVal:=2, ValueOf:="0", ByChange:=Sheets("OverTime").Range("Template_Schedule[COUNT]")
'SolverOk SetCell:="TargetCell", MaxMinVal:=2, ValueOf:="0", ByChange:="schTemplate"
SolverSolve True
End Sub

I'm not certain what the problem is because it runs just fine on another computer.

Thanks in advance.

4
  • 4
    Did you add a reference to the Solver library? (Tools>References>Solver) Commented Feb 20, 2014 at 17:56
  • @pnuts that was a typo, it's SolverReset. Commented Feb 20, 2014 at 18:01
  • 1
    @Tim Williams: I did not but now I did and it works. Thank you, that takes care of the issue. Commented Feb 20, 2014 at 18:01
  • 1
    @user1582396 do make it an answer and accept it please. Commented Sep 22, 2014 at 13:14

1 Answer 1

1

I followed up on Tim William's instructions to add a Reference to the Solver Library by going to Tools > References > Solver. It did the job and it works as intended.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.