jarvisjaska
New Member
- Joined
- Jan 13, 2021
- Messages
- 6
- Office Version
- 365
- Platform
- Windows
I've recorded a simple solver macro and I have two problems with it. The recorded code is shown below:
Problem 1: Recorder didn't record constraints (cells BD8 and BO8 should both equal 0)
Problem 2: I want to be able to run the macro on the active row (ie. the row I'm currently on). For example, if I'm on row 11 I need to set cell BU11 to 0 by changing cells BC11 and BQ11. Also cells BD11 and BO11 should both equal 0.
Any ideas on how to solve these problems?
VBA Code:
Sub Macro1()
'
' Macro1 Macro
'
'
SolverReset
SolverOk SetCell:="$BU$8", MaxMinVal:=3, ValueOf:=0, ByChange:="$BC$8,$BQ$8", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverOk SetCell:="$BU$8", MaxMinVal:=3, ValueOf:=0, ByChange:="$BC$8,$BQ$8", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverSolve userFinish:=True
End Sub
Problem 1: Recorder didn't record constraints (cells BD8 and BO8 should both equal 0)
Problem 2: I want to be able to run the macro on the active row (ie. the row I'm currently on). For example, if I'm on row 11 I need to set cell BU11 to 0 by changing cells BC11 and BQ11. Also cells BD11 and BO11 should both equal 0.
Any ideas on how to solve these problems?