For Next loop with uneven intervals

  • Hello,

    I was wondering if it's possible to create a For Next loop with uneven intervals as described below as opposed to creating many different loops.


    For i = (1 To 50), (100-150), (200-250)

  • Thank you for your response. I'll try to explain a little more clearly.

    I have an array of 3650 values corresponding to 10 years of daily information. I want to place values from 12 worksheet cells into the array. For example lets say I have a counter i for the array. I want the first value from the worksheet cell to be placed in the array i values of 1-30, 365-395, 730-760, 1095-1125 and so on. I was wondering if I could use a one loop to place the values into the array as opposed to a loop for each interval.

    I hope this description makes it easier to understand.
    Thanks again,


  • Something like this

    For i = 0 To 2
           j = Array(0, 365, 1095)(i)
           For x = j To j + 30
           Next x
    Next i
    End Sub

    If you walked away smiling-then for you the price was right

  • I suspect this is very similar to other answers that will be posted in the meantime, but here goes:

    Hope this helps.



Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!