Problème avec le Solveur

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 ?
 

Statistiques des forums

Discussions
312 160
Messages
2 085 837
Membres
102 999
dernier inscrit
francoisarg56