Hello,
For my optimization problem I use solver function which parametars are changed depending of some data is checked or not for calculation.
My problem is how to define parameter ByChange:= in solver function
I tried to use array of range but that doesn't work
Here is my code
For a = 1 To 24
SolverReset
c = ws.Range("d11")
j = 0
For b = 1 To 12
If c = True Then
j = j + 1
d = ws.Range("F" & 10 + b)
e = ws.Range("g" & 10 + b)
f = ws.Range("ag" & 10 + b)
If f < d Then
ws.Range("d" & 11 + b) = False
Else
If f < e Then
ws.Range("g" & 10 + b) = f
End If
End If
Set I(j) = Range("H" & b + 10)
SolverAdd CellRef:=ws.Cells(10 + b, a + 7), Relation:=3, FormulaText:=d
SolverAdd CellRef:=ws.Cells(10 + b, a + 7), Relation:=1, FormulaText:=e
End If
c = ws.Range("d" & 11 + b)
Next
SolverAdd CellRef:=ws.Cells(23, a + 7), Relation:=2, FormulaText:=ws.Cells(10, a + 7)
SolverOk SetCell:=Cells(27, 35 + a), MaxMinVal:=2, ValueOf:="0", ByChange:=I
SolverSolve userFinish:=True
Next
End Sub
Please help
Bookmarks