I have a piece of code that runs solver very well, but ranges have been hard coded. I need them to be flexible.
Basically I want a loop to find each occurance of the word "Week" in range AS3:AS325. When it finds the word in the range, use that activecell.offset to fill in the variables.
Is this possible?
Thanks for any help,
Kurt
rng = Sheets("sheet1").Range("AS3:AS325")
a = ActiveCell.Offset(i, 2)
SetCell:=ActiveCell.Offset(i, 5)
MaxMinVal:=3
ValueOf:=a
ByChange:= ActiveCell.Offset(i-5,3):ActiveCell.Offset(i,3)
SolverAdd CellRef:=ActiveCell.Offset(i-5,3):ActiveCell.Offset(i,3) Relation:=1, FormulaText:="3"
SolverAdd CellRef:=ActiveCell.Offset(i-5,3):ActiveCell.Offset(i,3) Relation:=3, FormulaText:="1"
SolverAdd CellRef:=ActiveCell.Offset(i-5,3):ActiveCell.Offset(i,3) Relation:=4, FormulaText:="integer"
SolverSolve
Basically I want a loop to find each occurance of the word "Week" in range AS3:AS325. When it finds the word in the range, use that activecell.offset to fill in the variables.
Is this possible?
Thanks for any help,
Kurt
rng = Sheets("sheet1").Range("AS3:AS325")
a = ActiveCell.Offset(i, 2)
SetCell:=ActiveCell.Offset(i, 5)
MaxMinVal:=3
ValueOf:=a
ByChange:= ActiveCell.Offset(i-5,3):ActiveCell.Offset(i,3)
SolverAdd CellRef:=ActiveCell.Offset(i-5,3):ActiveCell.Offset(i,3) Relation:=1, FormulaText:="3"
SolverAdd CellRef:=ActiveCell.Offset(i-5,3):ActiveCell.Offset(i,3) Relation:=3, FormulaText:="1"
SolverAdd CellRef:=ActiveCell.Offset(i-5,3):ActiveCell.Offset(i,3) Relation:=4, FormulaText:="integer"
SolverSolve