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: 5
Default Macro Skip the Constraint (Solver)

Hi,

I'm using Microsoft Excel 2003, and try to use Macro to call solver. But I
observed that the result not 100% correct. After I checked, I found the
constraint for integer forcing has not been added (the forth constraint).
Please help me to solve this problem.

My second question is how to add the code for user add-in the Solver.xla
automatically?


============================================
Sub SolverMacro()
'
icol = Sheets("Simulation").[l1].CurrentRegion.Columns.Count
irow = Sheets("Simulation").[A1].CurrentRegion.Rows.Count

SolverReset
SolverAdd CellRef:=Range(Cells(9, 10), Cells(irow, 10)), Relation:=3,
FormulaText:="0"
SolverAdd CellRef:=Range(Cells(8, 12), Cells(8, icol)), Relation:=1,
FormulaText:=Range(Cells(2, 12), Cells(2, icol))
SolverAdd CellRef:=Range(Cells(8, 12), Cells(8, icol)), Relation:=3,
FormulaText:=Range(Cells(6, 12), Cells(6, icol))

€˜ THIS ONE NOT WORK
SolverAdd CellRef:=Range(Cells(8, 12), Cells(8, icol)), Relation:=4,
FormulaText:="integer"


SolverOptions MaxTime:=100, Iterations:=100, Precision:=0.000001,
AssumeLinear _
:=True, StepThru:=False, Estimates:=1, Derivatives:=1,
SearchOption:=1, _
IntTolerance:=5, Scaling:=False, Convergence:=0.0001,
AssumeNonNeg:=True



SolverOk SetCell:="$F$6", MaxMinVal:=1, ValueOf:="0",
ByChange:=Range(Cells(8, 12), Cells(8, icol))
SolverSolve(True)
End Sub

 
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
Using Solver with Linear Constraint(s) stef Excel Programming 0 June 12th 08 10:42 PM
solver result and constraint CHART rml Charts and Charting in Excel 0 November 10th 06 08:13 PM
Add Constraint - "Solver: tikchye_oldLearner57 Excel Discussion (Misc queries) 2 August 14th 06 06:37 AM
solver constraint jojo Excel Worksheet Functions 0 February 17th 05 10:11 PM
Setting a Solver constraint using vba? Tushar Mehta[_6_] Excel Programming 0 August 26th 03 04:34 PM


All times are GMT +1. The time now is 03:47 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"