Solveur fait n'importe quoi

  • Initiateur de la discussion Initiateur de la discussion Engue
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

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
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Retour