View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
msuryexcel msuryexcel is offline
external usenet poster
 
Posts: 1
Default Automating Solver in loop


Hello:
I am trying to use the SOlverOK module ina loop ina macro and I am no
able to reset the cosntraint set. Code I am using is below. PLEAS
HELP!!
thanks
msuryexcel
****
For j = 2 To numdates - k1
rj = rk + j
ri = rj - 500
riold = ri - 1
Range(col3 & rj).Select
SolverOk SetCell:=col3 & rj, MaxMinVal:=2, ValueOf:="0"
ByChange:= _
"$E$" & ri & ":$AA$" & ri
SolverDelete CellRef:="$AC$" & riold, Relation:=2
FormulaText:="1"
SolverAdd CellRef:="$AC$" & ri, Relation:=2, FormulaText:="1"
SolverOk SetCell:=col3 & rj, MaxMinVal:=2, ValueOf:="0"
ByChange:= _
"$E$" & ri & ":$AA$" & ri
SolverDelete CellRef:="$E$" & riold & ":$AA$" & riold
Relation:=3, FormulaText:="0"
SolverAdd CellRef:="$E$" & ri & ":$AA$" & ri, Relation:=3
FormulaText:="0"""

SolverOk SetCell:=col3 & rj, MaxMinVal:=2, ValueOf:="0"
ByChange:= _
"$E$" & ri & ":$AA$" & ri
SolverSolve

Next j
***

--
msuryexce
-----------------------------------------------------------------------
msuryexcel's Profile: http://www.excelforum.com/member.php...fo&userid=2816
View this thread: http://www.excelforum.com/showthread.php?threadid=47684