ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Visual Basic Macro For Solver (https://www.excelbanter.com/excel-programming/291775-visual-basic-macro-solver.html)

Velero

Visual Basic Macro For Solver
 

I would like to know how to creat a macro for Resetill all
the Solver options, before assinging parameters and run
it. The follwing example, taken from the microsoft
website, illustrates what´s going on. The macro runs okay,
but each time is saving the constraints on the window. I
presume it must be added an argument to reset all before.
Any help will be appreciated.

Velero


http://support.microsoft.com/default.aspx?
scid=/support/excel/content/solver/solver.asp

Sub Maximum_Profit()


Solverok setcell:=Range("G14"), maxminval:=1, _
bychange:=Range("G9:I9")
SolverAdd CellRef:=Range("E3:E7"), Relation:=1, _
FormulaText:="$B$3:$B$7"
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1

End Sub


Jonathan Rynd

Visual Basic Macro For Solver
 
"Velero" wrote in news:11fec01c3f64f$e46772e0
:

I would like to know how to creat a macro for Resetill all
the Solver options, before assinging parameters and run
it. The follwing example, taken from the microsoft
website, illustrates whatïs going on. The macro runs okay,
but each time is saving the constraints on the window. I
presume it must be added an argument to reset all before.


Are you saying that you want the macro to note what the existing options
are for Solver, save them somewhere, and restore them to the solver dialog
box after it completes?

I don't think that's possible.

--
My email address has an extra @ (spell it out) and an extra invalid. Please
remove them if you are not a spammer or list broker and want to reply.

Verlero

Visual Basic Macro For Solver
 
No, I am not saying that. Let me explain it again

I want to write a macro for running solver. The problem is
that each time you run it the Solver window in Excel is
saving the constraints (adding again the arguments in the
constraint window). I need to add an argument in order to
Reset all before seting the target, changing, and
constraint arguments.

Does this help as explanation?

Thanks for your answer

Velero


-----Original Message-----
"Velero" wrote in

news:11fec01c3f64f$e46772e0
:

I would like to know how to creat a macro for Resetill

all
the Solver options, before assinging parameters and run
it. The follwing example, taken from the microsoft
website, illustrates whatïs going on. The macro runs

okay,
but each time is saving the constraints on the window.

I
presume it must be added an argument to reset all

before.

Are you saying that you want the macro to note what the

existing options
are for Solver, save them somewhere, and restore them to

the solver dialog
box after it completes?

I don't think that's possible.

--
My email address has an extra @ (spell it out) and an

extra invalid. Please
remove them if you are not a spammer or list broker and

want to reply.
.


Dana DeLouis[_3_]

Visual Basic Macro For Solver
 
Is this what you are looking for?

SolverReset

SolverOk _
SetCell:=Range("G14"), _
MaxMinVal:=1, _
ByChange:=Range("G9:I9")

'...etc


Not sure, but for Jonathan's idea, I believe "SolverSave" and "SolverLoad"
are one method of saving/loading Solver options.
HTH.

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Verlero" wrote in message
...
No, I am not saying that. Let me explain it again

I want to write a macro for running solver. The problem is
that each time you run it the Solver window in Excel is
saving the constraints (adding again the arguments in the
constraint window). I need to add an argument in order to
Reset all before seting the target, changing, and
constraint arguments.

Does this help as explanation?

Thanks for your answer

Velero


-----Original Message-----
"Velero" wrote in

news:11fec01c3f64f$e46772e0
:

I would like to know how to creat a macro for Resetill

all
the Solver options, before assinging parameters and run
it. The follwing example, taken from the microsoft
website, illustrates whatïs going on. The macro runs

okay,
but each time is saving the constraints on the window.

I
presume it must be added an argument to reset all

before.

Are you saying that you want the macro to note what the

existing options
are for Solver, save them somewhere, and restore them to

the solver dialog
box after it completes?

I don't think that's possible.





All times are GMT +1. The time now is 01:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com