ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Solver - won't run Macro in Step Thru - help (https://www.excelbanter.com/excel-programming/318046-solver-wont-run-macro-step-thru-help.html)

Joe[_37_]

Solver - won't run Macro in Step Thru - help
 
Hi all,
I am having a terrible time getting Solver in Excel 2000 to run a
Macro at each iteration.

My ultimate goal is to have solver change values for a cell (or range
of cells) and call a Macro named "Unit_values_load" at each iteration,
look for a result value after Macro has run called "TotalExpValue" and
when TotalExpValue cannot be increased by changing cells, finish with
the results being the "Optimized" values for the cell (range of cells)
that could be changed.


Attached is the code :

Sub OptzBak()
SolverReset
SolverOptions Precision:=0.001, StepThru:=True, AssumeNonNeg:=True
SolverOk SetCell:=Range("TotalExpValue"), _
MaxMinVal:=1, _
ByChange:=("E103")
SolverAdd CellRef:=Sheets("Discount_value").Range("e103"), _
Relation:=1, _
FormulaText:=100
SolverSolve userFinish:=False, showRef:=("Unit_values_load")
SolverSave saveArea:=("Results!A1:A3")
End Sub

Note: I have Solver checked in references already, still didn't help.

Thanks for your help in advance..
-joe


All times are GMT +1. The time now is 04:00 AM.

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