Problème avec le Solveur

  • 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
J'ai programmé une Macro en VBA qui marchait il y a quelques jours et ne marche plus maintenant, il ne prend plus en considération l'une de mes contraintes à savoir :
Code:
'condition de pleine utilisation du montant du portefeuille
    SolverAdd CellRef:="$C$7", Relation:=2, FormulaText:="1"

dans le programme :

Code:
Sub solverminvariance()
     Feuil6.Select
     Feuil6.Range("$C$5:$AF$5") = 1


     SolverReset
  'réinitialise le solver
'---------
'conditions de non vente à découvert

    SolverAdd CellRef:="$C$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$D$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$E$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$F$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$G$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$H$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$I$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$J$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$K$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$L$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$M$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$N$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$O$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$P$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$Q$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$R$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$S$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$T$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$U$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$V$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$W$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$X$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$Y$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$Z$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$AA$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$AB$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$AC$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$AD$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$AE$5", Relation:=3, FormulaText:="0"
    SolverAdd CellRef:="$AF$5", Relation:=3, FormulaText:="0"
'---------
'condition de pleine utilisation du montant du portefeuille
    SolverAdd CellRef:="$C$7", Relation:=2, FormulaText:="1"
 '--- Minimisation du risque
 
    SolverOk SetCell:="$C$9", MaxMinVal:=2, ValueOf:="0", ByChange:="$C$5:$AF$5"
'--- Lancement du solveur
    SolverSolve
  
  Feuil1.Select

End Sub

S'il vous plait, à l'aide...
La cellule qui devrait être 1 vaut 0 ou 0.2 ou 0.69 ou 4657 ... C'est quoi ce bordel ?
 
- 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