Ceci est une page optimisée pour les mobiles. Cliquez sur ce texte pour afficher la vraie page.

Solveur fait n'importe quoi

Engue

XLDnaute Nouveau
Bonjour,
Mon solveur marchait très bien hier, je n'ai rien touché au code et maintenant il est devenu dingue il fait n'importe quoi.
Je lui donne la contrainte qu'une case soit égal à 1 et quand il finit elle vaut 0.2000912 ....
Quelqu'un pourrait m'expliquer ce qui se passe ça me rend fou...

Ci joint le code


Code:
Sub solvermaxrend()
Feuil6.Select
Feuil6.Range("$C$15:$AF$15").Select
Selection.Clear
     SolverReset
  'réinitialise le solver
'---------
'conditions de non vente à découvert

    SolverAdd CellRef:="$C$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$D$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$E$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$F$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$G$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$H$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$I$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$J$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$K$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$L$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$M$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$N$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$O$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$P$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$Q$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$R$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$S$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$T$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$U$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$V$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$W$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$X$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$Y$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$Z$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$AA$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$AB$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$AC$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$AD$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$AE$15", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$AF$15", Relation:=3, FormulaText:="0"
'---------
'condition de pleine utilisation du montant du portefeuille
    SolverAdd CellRef:="$C$17", Relation:=2, FormulaText:="1"

SolverOk SetCell:="$C$18", MaxMinVal:=1, ValueOf:="0", ByChange:="$C$15:$AF$15"
'--- Lancement du solveur
    SolverSolve
    Feuil1.Select

End Sub
 
Les cookies sont requis pour utiliser ce site. Vous devez les accepter pour continuer à utiliser le site. En savoir plus…