LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default variables in excel solver for vba

how can you use variables in excel solver? i don't want the changing
cell always to be "R1C1" i want it to be something that will change.
this is what i have so far:

SolverReset

SolverOk SetCell:="R & CStr(numProducts + 3) & C2", MaxMinVal:=2,
ValueOf:="0", _
ByChange:="R & CStr() & C & CStr() & :R & CStr() & C & CStr()"

SolverAdd CellRef:= _
"R2 & C & CStr(numSites + 3) & :R & CStr(numProducts + 1) & C &
CStr(numSites + 3)", Relation:=2, FormulaText:="1" 'every product must
be bought
SolverAdd CellRef:= _
"R & CStr(numProducts + 2) & C2:R & CStr(numProducts + 2) & C &
CStr(numSites + 1)", Relation:=5, FormulaText:="binary" 'binary
constraint visit or not
SolverAdd CellRef:= _
"R2 & C & CStr(numSites + 2) & :R & CStr(numProducts + 1) & C &
CStr(numSites + 2)", Relation:=3, FormulaText:="1"

SolverSolve UserFinish:=False
SolverFinish KeepFinal:=1

Can i use concatenation like that? am i just writing it wrong? vba
runs my sub without any errors so i'm really confused...

any ideas would be greatly appreciated...thanks!

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set solver constraints so variables are either 1 OR 0. Gwyndalf Excel Worksheet Functions 3 May 28th 08 06:44 PM
Excel Solver (Maximum Limit of no. of variables & constraints) Ritesh Excel Discussion (Misc queries) 1 August 8th 06 05:54 PM
Making solver solve for different set variables and listing result Michael Bev Excel Discussion (Misc queries) 0 April 13th 06 12:22 PM
Interesting Solver problem (Solver encounters an error) MrShorty Excel Discussion (Misc queries) 3 December 22nd 05 10:52 PM
solver and defining all variables different than one another excel_excel_excel Excel Discussion (Misc queries) 0 July 19th 05 07:38 AM


All times are GMT +1. The time now is 11:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"