I have the code
The above code is supposed to execute what is nested beneath For a, and For b, then perform one calculation on "Range(Cells(5, 1), Cells(5, 1))", then reset the values of a and b back to their initial values. I would think that this would mean that for the next loop, since a and b are reset, the For a and For b tasks will be performed again, but it looks like it is skipping over it and it just performs three more calculations on "Range(Cells(5, 1), Cells(5, 1))" and is done.
Am I approaching this wrong? I want the For a and For b codes to be performed again each time do "Range(Cells(5, 1), Cells(5, 1)).CalculateRowMajorOrder".
Code:
Option Explicit
Sub runner()
Dim a, b, c, starta, startb, startc As Long
starta = 11
startb = 11
Do Until Range(Cells(5, 1), Cells(5, 1)) > 3
For b = startb To 12 Step 1
For a = starta To 12 Step 1
Do Until Range(Cells(2, 1), Cells(2, 1)) > a
Range(Cells(2, 1), Cells(2, 1)).CalculateRowMajorOrder
Loop
Next a
Do Until Range(Cells(3, 1), Cells(3, 1)) > b
Range(Cells(3, 1), Cells(3, 1)).CalculateRowMajorOrder
Loop
Next b
Range(Cells(5, 1), Cells(5, 1)).CalculateRowMajorOrder
a = starta
b = startb
Loop
End Sub
Am I approaching this wrong? I want the For a and For b codes to be performed again each time do "Range(Cells(5, 1), Cells(5, 1)).CalculateRowMajorOrder".