Hi I am trying to use solver from VBA, however when I execute my code I get the following message: "sub or function not defined"
Any help would be welcomed in resolving this problem. Below is my solver code in VBA.
Thanks
''**Solver Calculations**
'Resets solver, allowing it to be clear when used next
SolverReset
'MAD is minimised by changing the Weights
SolverOk SetCell:="MAD", MaxMinVal:=2, ValueOf:="0", ByChange:="Weights"
'Portfolio Mean is greater than or equal to the expected return
SolverAdd CellRef:="PortfolioMean", Relation:=3, FormulaText:="d"
'Sum of Weights has to equal 1
SolverAdd CellRef:="$C$129", Relation:=2, FormulaText:="1"
'Assume non-negativity
SolverOptions AssumeNonNeg:=True
'Repeats the first constraint
SolverOk SetCell:="MAD", MaxMinVal:=2, ValueOf:="0", ByChange:="Weights"
'Ensures the results dialogue box does not appear
SolverSolve UserFinish:=False
'Solves the solver
SolverSolve
Any help would be welcomed in resolving this problem. Below is my solver code in VBA.
Thanks
''**Solver Calculations**
'Resets solver, allowing it to be clear when used next
SolverReset
'MAD is minimised by changing the Weights
SolverOk SetCell:="MAD", MaxMinVal:=2, ValueOf:="0", ByChange:="Weights"
'Portfolio Mean is greater than or equal to the expected return
SolverAdd CellRef:="PortfolioMean", Relation:=3, FormulaText:="d"
'Sum of Weights has to equal 1
SolverAdd CellRef:="$C$129", Relation:=2, FormulaText:="1"
'Assume non-negativity
SolverOptions AssumeNonNeg:=True
'Repeats the first constraint
SolverOk SetCell:="MAD", MaxMinVal:=2, ValueOf:="0", ByChange:="Weights"
'Ensures the results dialogue box does not appear
SolverSolve UserFinish:=False
'Solves the solver
SolverSolve