View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
sk[_4_] sk[_4_] is offline
external usenet poster
 
Posts: 3
Default Running a Macro at every Solver Iteration

Here is the macro that I wrote to test the solver. As I mentioned, I
can get to the macro from the solver in the first iteration but not
back for further iterations. Do I need to force a return?

Thanks
Sharad

Sub Macro1()
'

SolverOk SetCell:="$B$5", MaxMinVal:=1, ValueOf:="0",
ByChange:="$B$2"
SolverAdd CellRef:="$B$1", Relation:=3, FormulaText:="25"
SolverOptions MaxTime:=100, Iterations:=100, Precision:=0.000001,
AssumeLinear _
:=False, StepThru:=True, Estimates:=1, Derivatives:=1,
SearchOption:=1, _
IntTolerance:=5, Scaling:=False, Convergence:=0.0001,
AssumeNonNeg:=False

ans = SolverSolve(False, "Example()")

End Sub

Function Example()
Sheets("sheet1").Cells(1, "B") = -10 * Sheets("sheet1").Cells(2, "B") +
1000
End Function
-------------------
On Jan 25, 12:55 pm, "Dana DeLouis" wrote:
Hi. It works fine in Excel 2003.
However, the documentation is a bit flakey.
If you post your code, we may be able to help.

--
HTH :)
Dana DeLouis
Windows XP & Office 2003

"sk" wrote in oglegroups.com...





I am trying to run a macro at every solver iteration through showref.
However, the solver goes through only the first iteration and does not
optimize the target cell updated by the macro called through showref.


I found an old thread from a couple of years ago on the same issue.
Just wondering if folks were able to resolve this.


Thanks- Hide quoted text -- Show quoted text -