Hi,
I have created the following code to use solver when a cell is updated by a formula. It works fine.
Private Sub Worksheet_Calculate()
'Runs Macro when formula calculated
SolverReset
SolverOk SetCell:="$M$86", MaxMinVal:=1, ValueOf:=0, ByChange:="$N$86", Engine _
:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$M$86", Relation:=2, FormulaText:="$G$86"
SolverOk SetCell:="$M$86", MaxMinVal:=1, ValueOf:=0, ByChange:="$N$86", Engine _
:=1, EngineDesc:="GRG Nonlinear"
SolverOk SetCell:="$M$86", MaxMinVal:=1, ValueOf:=0, ByChange:="$N$86", Engine _
:=1, EngineDesc:="GRG Nonlinear"
SolverSolve userFinish:=True
End Sub
Is there a way I can make the solver function do this for another 50 rows directly below row 86 detailed above?
The formulas and cells will be the same but just a row down.
Is there a way I can make the macros run only when the cell for that row is modified. I am worried it will be a slow running worksheet if it is fired up eveytime a calculation is made.
Thanks in advance
Kyle
I have created the following code to use solver when a cell is updated by a formula. It works fine.
Private Sub Worksheet_Calculate()
'Runs Macro when formula calculated
SolverReset
SolverOk SetCell:="$M$86", MaxMinVal:=1, ValueOf:=0, ByChange:="$N$86", Engine _
:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$M$86", Relation:=2, FormulaText:="$G$86"
SolverOk SetCell:="$M$86", MaxMinVal:=1, ValueOf:=0, ByChange:="$N$86", Engine _
:=1, EngineDesc:="GRG Nonlinear"
SolverOk SetCell:="$M$86", MaxMinVal:=1, ValueOf:=0, ByChange:="$N$86", Engine _
:=1, EngineDesc:="GRG Nonlinear"
SolverSolve userFinish:=True
End Sub
Is there a way I can make the solver function do this for another 50 rows directly below row 86 detailed above?
The formulas and cells will be the same but just a row down.
Is there a way I can make the macros run only when the cell for that row is modified. I am worried it will be a slow running worksheet if it is fired up eveytime a calculation is made.
Thanks in advance
Kyle