Question
In the VBA for modelers 4th edetion, chapter 26 problem 1E, step 7, my code is totalNPVOpt(tollndex) = Range(TotNPV), but an error appears saying that
In the VBA for modelers 4th edetion, chapter 26 problem 1E, step 7, my code is totalNPVOpt(tollndex) = Range("TotNPV"), but an error appears saying that it was supposed to be a matrix in there. Can anyone help me please?
Edit: This is the sub that i'm working on
Sub RunSolver(tollndex As Integer)
Dim tolerance As Single, i As Integer If tollndex = 0 Then tolerance = 0 Else tolerance = 5 End If With wsModel SolverReset SolverOK SetCell:=.Range("TotNPV"), MaxMinVal:=1, ByChange:=.Range("InvLevel") SolverOptions IntTolerance:=tolerance, AssumeLinear:=True SolverAdd CellRef:=.Range("TotCost"), Relation:=1, FormulaText:="Budget" SolverAdd CellRef:=.Range("InvLevel"), Relation:=5 SolverSolve UserFinish:=True For i = 1 To nProjects zeroOne(tollndex, i) = Range("Invlevel").Cells(i) Next totalNPVOpt(tollndex) = Range("TotNPV") leftoverOpt(tollndex) = Range("Budget") - Range("TotCost") End Sub
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started