Solver Loop VBA?

jsowa

New Member
Joined
Dec 10, 2019
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
Hi,
I have a problem with the solver function. I am trying to use VBA to loop a solver function from J through Q, and cannot figure it out...


1583964108998.png

This is the formula that is making this table possible:

SolverOk SetCell:="$J$14", MaxMinVal:=1, ValueOf:=0, ByChange:="$J$6:$J$12", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$J$15", Relation:=1, FormulaText:="$J$3"
SolverAdd CellRef:="$J$13", Relation:=2, FormulaText:="1"
SolverOk SetCell:="$J$14", MaxMinVal:=1, ValueOf:=0, ByChange:="$J$6:$J$12", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverOk SetCell:="$J$14", MaxMinVal:=1, ValueOf:=0, ByChange:="$J$6:$J$12", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverSolve

At the moment, I just re-wrote this formula for cells J-Q. I also do not know why cash is going negative, but I had set it to not go negative

Not to mention, not well versed in Excel's VBA as you can probably see from the formula.

Any help would be really appreciated!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Are you assuming all these stocks are independent and not correlated at all? That’s unlikely, and rather inaccurate, isn’t it?

normally, you would create a correlation table first and then generate correlated random numbers using it.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top