Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Excel Solver in VB

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ays - 12 May 2008 00:50 GMT
I am trying to run this piece of code but I am getting nothing but the first
constraint in the Solver. I'd be happy is someone could help me with this.
Thanks..

Public Sub DualSolver(K, M, N)
'Activate the DLP sheet
Sheets("DLP").Activate

'Reset the solver
SolverReset

'Objective Function
SolverOk SetCell:=Range("B4"), MaxMinVal:=1, ValueOf:="0",
ByChange:="Range(Cells(2, 2), Cells(2, M + N +
1)),Range(Cells(1,M+N+6),Cells(K,M+N+6))"

'Constraints

SolverAdd CellRef:=Cells(K + 1, M + N + 6), Relation:=2, FormulaText:="1"
SolverAdd CellRef:=Range(Cells(6, 2), Cells(6, M + N + 1)), Relation:=2,
FormulaText:="Range(Cells(8, 2), Cells(8, M + N + 1))"

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

ActiveWorkbook.Worksheets("DLP").Cells(100, 100).Formula = 1 / 0
'Solve
SolverSolve UserFinish:=True

'Finish and discard
SolverFinish KeepFinal:=2
End Sub
merjet - 12 May 2008 01:08 GMT
Try putting a line continuation character (underscore) at the end of
the first of these lines:
> SolverAdd CellRef:=Range(Cells(6, 2), Cells(6, M + N + 1)), Relation:=2,
> FormulaText:="Range(Cells(8, 2), Cells(8, M + N + 1))"

Hth,
Merjet
Ays - 12 May 2008 03:45 GMT
Thanks but it didn't help...

> Try putting a line continuation character (underscore) at the end of
> the first of these lines:
[quoted text clipped - 3 lines]
> Hth,
> Merjet

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.