You are on page 1of 2

Sub Minimiserlerisque()

Sheets("Portefeuille").Activate

SolverReset

SolverOk SetCell:="$C$18", MaxMinVal:=2, ValueOf:="0", ByChange:="$C$2:$C$6"

SolverAdd CellRef:="$C$7", Relation:=2, FormulaText:="100.00%"

For i = 1 To nbretitres

If Cells(i + 1, 1).Value = "n" Then

SolverAdd CellRef:=Cells(i + 1, 3), Relation:=2, FormulaText:="0,00%"

Else

SolverAdd CellRef:=Cells(i + 1, 3), Relation:=1, FormulaText:="$D$14"

SolverAdd CellRef:=Cells(i + 1, 3), Relation:=3, FormulaText:="$D$13"

End If

Next i

'SolverAdd CellRef:="$C$16", Relation:=2, FormulaText:="$D$10"

SolverSolve (True)

SolverFinish

End Sub

Sub Maximiserlerendement()

Sheets("Portefeuille").Activate

SolverReset

SolverOk SetCell:="$C$16", MaxMinVal:=1, ValueOf:="0", ByChange:="$C$2:$C$6"

SolverAdd CellRef:="$C$7", Relation:=2, FormulaText:="100.00%"

For i = 1 To nbretitres

If Cells(i + 1, 1).Value = "n" Then

SolverAdd CellRef:=Cells(i + 1, 3), Relation:=2, FormulaText:="0,00%"

Else

SolverAdd CellRef:=Cells(i + 1, 3), Relation:=1, FormulaText:="$D$14"

SolverAdd CellRef:=Cells(i + 1, 3), Relation:=3, FormulaText:="$D$13"

End If

Next i

'SolverAdd CellRef:="$C$18", Relation:=1, FormulaText:="$D$11"


SolverSolve (True)

SolverFinish

End Sub

You might also like