solverresults

H

Hannu Rantala

Hello!

Which would be the correct command in solver macro to shut
solverresults-window after iteration? SolverFinish doesn't do that.

Hannu Rantala
 
D

Dana DeLouis

I think you want to use the following:

SolverSolve True

If you wish to use the results with "SolverFinish", then here is just one
idea.

Sub Demo()
'// Dana DeLouis
Dim WhatHappened
Const KeepSolution = 1
Const DiscardSolution = 2

'// Don't display Solver

WhatHappened = SolverSolve(True)

Select Case WhatHappened
Case 1 To 3
'Solution should be ok
SolverFinish KeepSolution
Case Else
SolverFinish DiscardSolution
End Select
End Sub

HTH. :>)
 
H

Hannu Rantala

Dana DeLouis said:
I think you want to use the following:

SolverSolve True

If you wish to use the results with "SolverFinish", then here is just one
idea.

Sub Demo()
'// Dana DeLouis
Dim WhatHappened
Const KeepSolution = 1
Const DiscardSolution = 2

'// Don't display Solver

WhatHappened = SolverSolve(True)

Select Case WhatHappened
Case 1 To 3
'Solution should be ok
SolverFinish KeepSolution
Case Else
SolverFinish DiscardSolution
End Select
End Sub

HTH. :>)
Hello!

Having problems with code...how to use the command above?

i have this kind of code now:
Private Sub CommandButton1_Click()

Worksheets("Taul2").Activate
SolvReset
SolvOptions AssumeNonNeg:=True

SolvOk SetCell:="B22", MaxMinVal:=3, ValueOf:="0",
ByChange:="B5,B7,B9"
SolvAdd CellRef:="B4", Relation:=2, FormulaText:="B6"
SolvAdd CellRef:="B5", Relation:=2, FormulaText:="B8"
SolvSolve

SolvReset
SolvOptions AssumeNonNeg:=True
SolvOk SetCell:="C22", MaxMinVal:=3, ValueOf:="0",
ByChange:="C5,C7,C9"
SolvAdd CellRef:="C4", Relation:=2, FormulaText:="C6"
SolvAdd CellRef:="C5", Relation:=2, FormulaText:="C8"
SolvSolve
 
H

Hannu Rantala

Dana DeLouis said:
I think you want to use the following:

SolverSolve True

If you wish to use the results with "SolverFinish", then here is just one
idea.

Sub Demo()
'// Dana DeLouis
Dim WhatHappened
Const KeepSolution = 1
Const DiscardSolution = 2

'// Don't display Solver

WhatHappened = SolverSolve(True)

Select Case WhatHappened
Case 1 To 3
'Solution should be ok
SolverFinish KeepSolution
Case Else
SolverFinish DiscardSolution
End Select
End Sub

HTH. :>)

Ohhoh!

I must be very good sleeping programmer! SolverFinish True does
exactly what I want. Forget my previous message. And thanks for help
because your notification woke me up!
Hannu
 
Top