I'm surprised that nobody has commented on the flaw in the code in #2. The loop should be
For iVal = iValX - 1 to 0 step -1
not
For iVal = 0 To iValX - 1
For newer users, the issue can be demo'd by the example of 3 open forms, frmA, frmB and frmC opened in that order. Forms(0) will be...