MamboKing
07-04-2008, 05:16 PM
Dim theMatrix(1 To 100) As Double
Dim idxRow As Integer
Do While theMatrix(idxRow) = m
....
....
idxRow = idxRow - 1
If idxRow = 0 Then Exit Do
Loop
It happens that although idxRow goes to zero (Exit condition) the VBA still checks the While conditions before exiting.
In fact, the error "Subscript out of range" pops up and it refers to the check of While theMatrix(0). Of course such index is invalid for theMatrix.
Did anyone experice something similar ever?
Hoping for some feedback. Thanks.
Dim idxRow As Integer
Do While theMatrix(idxRow) = m
....
....
idxRow = idxRow - 1
If idxRow = 0 Then Exit Do
Loop
It happens that although idxRow goes to zero (Exit condition) the VBA still checks the While conditions before exiting.
In fact, the error "Subscript out of range" pops up and it refers to the check of While theMatrix(0). Of course such index is invalid for theMatrix.
Did anyone experice something similar ever?
Hoping for some feedback. Thanks.