0
VBA Excelのソルバーコマンドをループし、モデル内の変数と条件に関するエラーメッセージを取得しようとしています。このモデルのアイデアは、現金収支がゼロであり、債務と資本構成要素が(ソルバー実行の境界として働く)特定の約定を満たすように、一連の負債と株式融資を見つけることです。私は私が間違ってソルバーパターンで変数を参照推測VBA Excel - ループ内のソルバーは、セルと条件の変更を参照してエラーを返します。
Sub Debt_Capital_Balancing()
Application.ScreenUpdating = False
Dim Early_Repmnt As String, CashBeforeSolver As Variant, CED As Variant, _
DR As Variant, CC As Variant, TW As Single, NDE As Single, DE As Single, W As Single
K = Range("Forecast_periods").Count
Range("Debt_Received, Debt_Early_Repayment, RE_Distribution, _ CC_APIC_Change").ClearContents
For i = 1 To K
CashBeforeSolver = Abs(Range("Cash_Excess_Deficit").Cells(1, i).Value)
CED = Range("Cash_Excess_Deficit").Cells(1, i).Value
DR = Range("Debt_Received").Cells(1, i).Value
CC = Range("CC_APIC_Change").Cells(1, i).Value
TW = Range("Target_WACC").Cells(1, i).Value
NDE = Range("Net_Debt_To_EBITDA").Cells(1, i).Value
DE = Range("D_E").Cells(1, i).Value
W = Range("WACC").Cells(1, i).Value
SolverReset
SolverOk SetCell:=CED, MaxMinVal:=3, ValueOf:=0, ByChange:="DR,CC", Engine:=3, EngineDesc:="Evolutionary"
SolverAdd cellRef:=DR, Relation:=3, FormulaText:=0
SolverAdd cellRef:=CC, Relation:=3, FormulaText:=0
SolverAdd cellRef:=DR, Relation:=1, FormulaText:=CashBeforeSolver
SolverAdd cellRef:=CC, Relation:=1, FormulaText:=CashBeforeSolver
SolverAdd cellRef:=NDE, Relation:=1, FormulaText:="Target_Net_Debt_To_EBITDA"
SolverAdd cellRef:=DE, Relation:=1, FormulaText:="Target_D_E_Ratio"
SolverAdd cellRef:=W, Relation:=1, FormulaText:=TW
SolverOptions MaxTime:=0, Iterations:=0, Precision:=0.00001, _
Convergence:=0.0001, StepThru:=False, Scaling:=True, AssumeNonNeg:=False, Derivatives:=1
SolverOptions PopulationSize:=100, RandomSeed:=0, MutationRate:=0.075, _
Multistart:=False, RequireBounds:=True, MaxSubproblems:=0, MaxIntegerSols:=0, _
IntTolerance:=0.1, SolveWithout:=False, MaxTimeNoImp:=200
SolverSolve
Next i
End Sub
:
は、ここに私のコードです。 誰かが私を助けてくれますか?変化する細胞と動的条件を参照する他の方法があるかもしれませんか?
多くのおかげで、
ユーリー
エラーメッセージは何ですか。 –
コードによるシングルステップ: 1.どのラインでエラーが発生しますか? 2:エラーは何ですか(Dy.Leeの場合も同様) – peakpeak