I am running a vba code as follows:
Dim score As Integer
SolverReset
score = Range("N3").Value
If score = 1 Then
SolverLoad loadArea:=Range("N4:N11")
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1
SolverReset
SolverLoad loadArea:=Range("O4:O14")
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1
SolverReset
Else:
SolverReset
SolverLoad loadArea:=Range("P4:P15")
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1
End If
SolverReset
score = Range("N48").Value
If score = 1 Then
SolverLoad loadArea:=Range("N49:N56")
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1
SolverReset
SolverLoad loadArea:=Range("O49:O59")
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1
SolverReset
Else:
SolverReset
SolverLoad loadArea:=Range("P49:P60")
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1
End If
As you can see the first half of the code is repeated again. The range changes from N3 to N48, N4 to N49 and so on.
Now I have to keep repeating the entire code for 172 iterations only changing the range Part which is the cell references to the solver location.
Is there some way I can repeat the process for 172 times using for loop by some how changing the references after each iteration.
All the references increase by +45 each iteration, as is visible.