excel - VBA Solver not Looping -
i trying use solver on multiple columns (the exact number of columns being defined user). after looking @ questions here, still can't find what's wrong code (i pretty new vba). when run it, works fine first year not apply following years.
dim wsfm_b3 worksheet set wsfm_b3 = thisworkbook.worksheets("xxxx_b3") dim wscharts worksheet set wscharts = thisworkbook.worksheets("charts") dim j integer j = 0 range("cc_reduction_years").value solverreset solveradd cellref:=wsfm_b3.range("e_start").offset(0, j), relation:=3, formulatext:=wscharts.range("min_e") solveradd cellref:=wsfm_b3.range("bank_start").offset(0, j), relation:=3, formulatext:=wsfm_b3.range("cash_b3") solverok setcell:=wsfm_b3.range("poy_start").offset(0, j).address, maxminval:=3, valueof:=0, bychange:=wscharts.range("cc_base_start").offset(0, j).address, engine _ :=1, enginedesc:="grg nonlinear" solversolve true next j end sub
here xxxx_b3
sheet looks like:
on "charts" sheet there cells containing target values first line, constraints, , number of years.
Comments
Post a Comment