VBA/Solver Loop Help - Incremental Changes on Objective Value -
i have created , edited simple macro (code below) runs solver copies , pastes results/data affected cells in next available blank row in column e.
currently objective set minimise cell h33 changing cells j33:p33 constraint figures in j33:p33 must sum 1. loop macro specified number of iterations (e.g. 50) want able set cell h33 specified value (e.g. 6), run solver, copy & paste described loop through on each loop, specified value in cell h33 increases incrementally (e.g. 0.1) on each run.
sub test() ' ' test macro ' solverreset solverok setcell:="$h$33", maxminval:=2, valueof:=0, bychange:="$j$33:$p$33", _ engine:=1, enginedesc:="grg nonlinear" solveradd cellref:="$q$33", relation:=2, formulatext:="1" solversolve true range("e33:p33").copy sheets("output").range("e" & rows.count).end(xlup).offset(1, 0).pastespecial xlpasteall end sub
Comments
Post a Comment