Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default Need advice on Solver loop

Hi,

I have a loop that executes Solver -- I have the following questions:

1 - It appears that once Solver is first set up to run, it stores the values
and constraints so that if they are not changed, it will keep those initial
values. Assuming this is correct and given that I am referencing cells on my
sheet that change in value with each instance of the loop, I'm thinking that
all I need to do is set up Solver once in my code for it's initial run and
then just have it execute each time it loops through. Does this sound right
to you? Below is my Solver code within the loop.

SolverOk SetCell:="$AF$1", MaxMinVal:=2, ValueOf:="0", _
ByChange:="payfclearbin"
SolverAdd CellRef:="payfclearbin", Relation:=5, FormulaText:="binary"
SolverAdd CellRef:="$AE$1", Relation:=2, FormulaText:=Range("AD1").Value
SolverSolve userfinish:=True

2 - Just in case I need to, if I wanted to delete all prior constraints
("Cellref"), is there a way to have all constraints deleted at once rather
than deleting each individual constraint one by one?


Thanks!

Robert

--
Robert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default Need advice on Solver loop

is there a way to have all constraints deleted at once rather
than deleting each individual constraint one by one?


Hi. Just my opinion is that it's hard to keep track on Constraints to
delete them 1 by 1.
I find it easier to just do a "Reset".

SolverReset
SolverOk SetCell:="AF1", MaxMinVal:=2, ByChange:="PayfClearBin"

Now, you are back to normal with no constraints.

(Note: you can drop the =0 since it's ignored)

--
HTH
Dana DeLouis


"robs3131" wrote in message
...
Hi,

I have a loop that executes Solver -- I have the following questions:

1 - It appears that once Solver is first set up to run, it stores the
values
and constraints so that if they are not changed, it will keep those
initial
values. Assuming this is correct and given that I am referencing cells on
my
sheet that change in value with each instance of the loop, I'm thinking
that
all I need to do is set up Solver once in my code for it's initial run and
then just have it execute each time it loops through. Does this sound
right
to you? Below is my Solver code within the loop.

SolverOk SetCell:="$AF$1", MaxMinVal:=2, ValueOf:="0", _
ByChange:="payfclearbin"
SolverAdd CellRef:="payfclearbin", Relation:=5, FormulaText:="binary"
SolverAdd CellRef:="$AE$1", Relation:=2, FormulaText:=Range("AD1").Value
SolverSolve userfinish:=True

2 - Just in case I need to, if I wanted to delete all prior constraints
("Cellref"), is there a way to have all constraints deleted at once rather
than deleting each individual constraint one by one?


Thanks!

Robert

--
Robert


Reply
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
Interesting Solver problem (Solver encounters an error) MrShorty Excel Discussion (Misc queries) 3 December 22nd 05 10:52 PM
Automating Solver in loop msuryexcel Excel Programming 2 October 18th 05 03:24 PM
Error message when using the Solver in a VBA macro loop Mathieu Fournier Excel Programming 2 March 1st 05 02:36 PM
Resetting Solver Manually to Fix Solver Bug Stratuser Excel Programming 0 September 13th 04 07:04 PM
Advice about loop and cell action Tetsuhara Excel Programming 1 June 23rd 04 01:00 PM


All times are GMT +1. The time now is 02:42 PM.

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

About Us

"It's about Microsoft Excel"