I have a really simple problem. I'm trying to nest two "Do While" loops in Excel VBA. Test code below re-produces the issue I am having.
The code below should produce 12 message boxes. 9 for the nested loop as it is being triggered three time with the master loop that is also triggered three times and 3 further message boxes for the master loop.
What I'm finding is the two loops are operating in series as though they are not nested so I'm getting 6 message boxes in total.
I'm sure I have used nested loops in VBA in the past with no issue (although now I might need to go back and check).
Why are the nested loops behaving in a series? How does it behave on your computer? Am I missing a simple syntax error?
Sub test()
i = 0
m = 0
Do While i < 3
Do While m < 3
MsgBox ("Nested Loop " & m)
m = m + 1
Loop
MsgBox ("Master Loop " & i)
i = i + 1
Loop
End Sub