Dear All,
I am not an expert of VBA at all, therefore, I'll try to be as clear as I can.
I am trying to create a code to automatically run a Solver across several columns. I managed to create a basic code that does the job, but that means that I have to copy and paste the code for all the rows I need it, and they are about 500.
I was wondering if you could kindly help me to make a code that loops through all the columns at regular intervals.
Here is a sample of what I need (without loop):
Could you be so kind to adjust it to make it loop until no columns are found?
Kind regards,
Simone
I am not an expert of VBA at all, therefore, I'll try to be as clear as I can.
I am trying to create a code to automatically run a Solver across several columns. I managed to create a basic code that does the job, but that means that I have to copy and paste the code for all the rows I need it, and they are about 500.
I was wondering if you could kindly help me to make a code that loops through all the columns at regular intervals.
Here is a sample of what I need (without loop):
VBA Code:
Sub provando()
Worksheets("M1").Activate
SolverReset
SolverOptions precision:=0.000001, Iterations:=10000
SolverOK setCell:=Range("$E$415"), maxMinVal:=2, ByChange:=Range("$E$411", "$E$412")
SolverAdd cellRef:=Range("$E$412"), Relation:=3, formulaText:="$E$413"
SolverAdd cellRef:=Range("$E$412"), Relation:=1, formulaText:="$E$414"
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1
SolverReset
SolverOptions precision:=0.000001, Iterations:=10000
SolverOK setCell:=Range("$G$415"), maxMinVal:=2, ByChange:=Range("$G$411", "$G$412")
SolverAdd cellRef:=Range("$G$412"), Relation:=3, formulaText:="$G$413"
SolverAdd cellRef:=Range("$G$412"), Relation:=1, formulaText:="$G$414"
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1
SolverReset
SolverOptions precision:=0.000001, Iterations:=10000
SolverOK setCell:=Range("$I$415"), maxMinVal:=2, ByChange:=Range("$I$411", "$I$412")
SolverAdd cellRef:=Range("$I$412"), Relation:=3, formulaText:="$I$413"
SolverAdd cellRef:=Range("$I$412"), Relation:=1, formulaText:="$I$414"
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1
End Sub
Could you be so kind to adjust it to make it loop until no columns are found?
Kind regards,
Simone