Excel Solver VBA -


one of equations in solver model creating in excel vba macro follows:

solveradd cellref:="$m$18:$m$30", relation:=2, formulatext:="$n$18:$n$30" 

how implement row number "18" value can read input cell? example, cell a1 may have value 18, want used in equation. if value in a1 10, equation should read as:

solveradd cellref:="$m$10:$m$30", relation:=2, formulatext:="$n$10:$n$30" 

similarly, variables defined as:

solverok setcell:="$h$47", maxminval:=2, valueof:=0, bychange:="$h$18:$j$30,$r$18:$r$30", _     engine:=1, enginedesc:="simplex lp" 

again, when value of number in cell a1 changes from, 18 10, variables should change "$h$18:$j$30,$r$18:$r$30" "$h$10:$j$30,$r$10:$r$30".

i appreciate suggestions.

thanks lot.

  • to have variable input use this: input_variable = .cells(1,1) or input_variable = range("a1") , change "$m"&input_variable&":$m$30

refer question further ways: vba: selecting range variables or range variable vba

  • another alternative use solverstudio, useful, because model in excel using famous optmisation libraries.

as problems grows, excel seems unable solve problems , there many other professional softwares uses optimisation modelling languages.

if try install problems can happen, enter link solve: help page problem different , solved here.

in classes taught in ampl, programming solverstudio easier excel vba, because solverstudio's languages focused on optimisation problems.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -