VBA Solver ohne Zellbezug
11.11.2019 12:57:50
Ano
Ich habe ein Problem mit der Integration der Solver Funktion in mein VBA Skript.
Ich möchte den Solver komplett mit Variablen ansteuern, die ich im VBA Code definiert habe.
Dafür möchte ich den Verweis auf Zellen im Excel-Blatt vermeiden.
Wie kann ich die Funktionen SolverOk und SolverAdd mit VBA Variablen bestücken?
SolverOk SetCell:=Sum11, MaxMinVal:=2, ValueOf:=0, ByChange:=MSAJ_EK11 & MSAJ_ES11 & MSAJ_nKS11 & MSAJ_nSK11, _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:=MSAJ_EK11, Relation:=3, FormulaText:="1"
SolverAdd CellRef:=MSAJ_ES11, Relation:=3, FormulaText:="1"
SolverAdd CellRef:=MSAJ_nKS11, Relation:=3, FormulaText:="1"
SolverAdd CellRef:=MSAJ_nSK11, Relation:=3, FormulaText:="1"
SolverAdd CellRef:=MSAJ_nKS11, Relation:=1, FormulaText:="0.4999999999"
SolverAdd CellRef:=MSAJ_nSK11, Relation:=1, FormulaText:="0.9999999999"
SolverAdd CellRef:=MSAJ_EKS111, Relation:=2, FormulaText:=MSAJ_ESK111
SolverAdd CellRef:=MSAJ_EKS211, Relation:=2, FormulaText:=MSAJ_ESK211
SolverAdd CellRef:=MSAJ_EKS311, Relation:=2, FormulaText:=MSAJ_ESK311
SolverAdd CellRef:=MSAJ_EKS411, Relation:=2, FormulaText:=MSAJ_ESK411
SolverAdd CellRef:=MSAJ_EKS511, Relation:=2, FormulaText:=MSAJ_ESK511
SolverSolve UserFinish:=True
Die dick gedruckten Variablen sind alle im Skript definiert.
Vielen Dank für die Hilfe.
Liebe Grüße