Hi,
I have a solver set up in excel to keep the value of Y23 equal to 0.0005 by changing the value of N23. I also want to eb able to loop it so it does that for every line (ie. Y24 to equal 0.0005 by changing N24 and so on...) until it encounters a blank cell. I got Solver to work for it, but not the looping code. I keep getting an error at the "Do Until" line. here is my code:
Sub Stat()
'
Do Until Cells(rctr, 23).Value = ""
rctr = rctr + 1
rctr = 23
'
SolverReset
SolverOk SetCell:="$Y$23", MaxMinVal:=3, ValueOf:=0.0005, ByChange:="$N$23", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$N$23", Relation:=3, FormulaText:="0.0001"
SolverOk SetCell:="$Y$23", MaxMinVal:=3, ValueOf:=0.0005, ByChange:="$N$23", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverOk SetCell:="$Y$23", MaxMinVal:=3, ValueOf:=0.0005, ByChange:="$N$23", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverSolve True
Loop
End Sub
any help would be appreciated, Thanks.
I have a solver set up in excel to keep the value of Y23 equal to 0.0005 by changing the value of N23. I also want to eb able to loop it so it does that for every line (ie. Y24 to equal 0.0005 by changing N24 and so on...) until it encounters a blank cell. I got Solver to work for it, but not the looping code. I keep getting an error at the "Do Until" line. here is my code:
Sub Stat()
'
Do Until Cells(rctr, 23).Value = ""
rctr = rctr + 1
rctr = 23
'
SolverReset
SolverOk SetCell:="$Y$23", MaxMinVal:=3, ValueOf:=0.0005, ByChange:="$N$23", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$N$23", Relation:=3, FormulaText:="0.0001"
SolverOk SetCell:="$Y$23", MaxMinVal:=3, ValueOf:=0.0005, ByChange:="$N$23", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverOk SetCell:="$Y$23", MaxMinVal:=3, ValueOf:=0.0005, ByChange:="$N$23", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverSolve True
Loop
End Sub
any help would be appreciated, Thanks.