VBA - Multiple solvers - Same workbook different sheet

StianKvam

New Member
Joined
Feb 23, 2018
Messages
4
Hello.

I have a workbook that contains several sheets. I'm trying to make two solvers run on separate sheets, solver 2 is dependant on solver 1.
Solver 1 works as it should but I can't get solver 2 to run by itself, I have inserted a button for solver 2 to work but I would like to run it automatically.

The solvers are placed in each module where I call the first macro in sheet1 with Worksheet_Change.
The "goal cell" from solver 1 is affecting the "changing cell" in solver 2.

Can anyone help me with this ?

Solver1:

Code:
Sub Centrifuge_load()


 'Centrifuge_load Macro


    SolverReset
    SolverAdd CellRef:="$D$36", Relation:=2, FormulaText:="$E$36"
    SolverAdd CellRef:="$N$19", Relation:=2, FormulaText:="$E$28"
    SolverOk MaxMinVal:=0, ValueOf:=0, ByChange:="$E$34,$D$29", Engine:=1, _
        EngineDesc:="GRG Nonlinear"
    SolverOk MaxMinVal:=0, ValueOf:=0, ByChange:="$E$34,$D$29", Engine:=1, _
        EngineDesc:="GRG Nonlinear"
    SolverSolve True
    
End Sub

Solver2:
Code:
sub Evap_C02002()


    SolverOk SetCell:="$J$8", MaxMinVal:=3, ValueOf:=0, ByChange:="$F$13", Engine:= _
        1, EngineDesc:="GRG Nonlinear"
    SolverOk SetCell:="$J$8", MaxMinVal:=3, ValueOf:=0, ByChange:="$F$13", Engine:= _
        1, EngineDesc:="GRG Nonlinear"
    SolverSolve True
    
End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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