Forum

Automate Solver usi...
 
Notifications
Clear all

Automate Solver using VBA

2 Posts
2 Users
0 Reactions
119 Views
(@howardc)
Posts: 54
Trusted Member
Topic starter
 

I have the following vBA code to automate Solver, and need it amended to that it runs without bgetting a run time error "SAub or function not defined

I also need the following changes:

1) I need ValueOf:=72 to refer to cell F1 so that this will change each time F1 is amendedd

2) I need $E$$27 to refer to the last cell in Col D in ByChange:="$E$2:$E$27" for EG "$E2:$E$" & Lastrow

 

Option Explicit
Sub Solver()

SolverOk SetCell:="$E$1", MaxMinVal:=3, ValueOf:=72, ByChange:="$E$2:$E$27", _
Engine:=2, EngineDesc:="Simplex LP"
SolverOk SetCell:="$E$1", MaxMinVal:=3, ValueOf:=72, ByChange:="$E$2:$E$27", _
Engine:=2, EngineDesc:="Simplex LP"
SolverSolve
End Sub

 

I have also posted on Amend solver VBA Code | MrExcel Message Board and Macro to automate Solver (excelforum.com)

 
Posted : 18/07/2021 11:27 pm
Philip Treacy
(@philipt)
Posts: 1630
Member Admin
 

Resolved.

 
Posted : 21/07/2021 5:23 am
Share: