Guten Abend,
und zwar folgendes Anliegen ich bekomme in meinem Code:
' Code for production optimization
'Part 1: Initialization
Sub Konsto1()
'Declare variables
Dim x1_1 As Double, x1_2 As Double, x1_3 As Double, x1_4 As Double, x1_5 As Double
Dim x2_1 As Double, x2_2 As Double, x2_3 As Double, x2_4 As Double, x2_5 As Double, x2_6 As Double, x2_7 As Double
Dim x3_1 As Double, x3_2 As Double, x3_3 As Double, x3_4 As Double, x3_5 As Double, x3_6 As Double, x3_7 As Double
'Set Objective function
SolverAdd SetCell:="A$1", MaxMinVal:=1, ValueeOf:=x1_1+x1_2+x1_3+x1_4+x1_5+x2_1+x2_2+x2_3+x2_4+x2_5+x2_6+x2_7+x3_1+x3_2+x3_3+x3_4+x3_5+x3_6+x3_7,
'Add constraints
' x1_1 + x1_2 + x1_3 + x1_4 + x1_5 <= 5*24*6.4
SolverAdd CellRef:="$B$1", Relation:=1, FormulaText:="$B$2<=768"
' x2_1 + x2_2 + x2_3 + x2_4 + x2_5 + x2_6 + x2_7 <= 7*24*4.8
SolverAdd CellRef:="$C$1", Relation:=1, FormulaText:="$C$2<=10368"
' x3_1 + x3_2 + x3_3 + x3_4 + x3_5 + x3_6 + x3_7 <= 7*24*5.1
SolverAdd CellRef:="$D$1", Relation:=1, FormulaText:="$D$2<=10824"
' x1_1 + x1_2 + x1_3 + x1_4 + x1_5 = 5*24*6.4
SolverAdd CellRef:="$B$1", Relation:=5, FormulaText:="$B$2=768"
' x2_1 + x2_2 + x2_3 + x2_4 + x2_5 + x2_6 + x2_7 = 7*24*4.8
SolverAdd CellRef:="$C$1", Relation:=5, FormulaText:="$C$2=10368"
' x3_1 + x3_2 + x3_3 + x3_4 + x3_5 + x3_6 + x3_7 = 7*24*5.1
SolverAdd CellRef:="$D$1", Relation:=5, FormulaText:="$D$2=10824"
'Solve the model
SolverSolve
'Output the results
SolverFinish KeepFinal:=1
End Sub
immer einen Syntaxfehler in der Zeile SolverAdd SetCell:="A$1", MaxMinVal:=1, ValueeOf:=x1_1+x1_2+x1_3+x1_4+x1_5+x2_1+x2_2+x2_3+x2_4+x2_5+x2_6+x2_7+x3_1+x3_2+x3_3+x3_4+x3_5+x3_6+x3_7, ,habt ihr Ideen was das Problem ist?
Bin noch nicht sehr gut mit VBA, ist eher ein Copy&Paste bei mir, würde trotzdem gerne verstehen, wieso es nicht funktioniert.
Vielen Dank =)
|