For 1 To 12 Statement With Interval

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • etangman
    New Member
    • Jul 2007
    • 6

    For 1 To 12 Statement With Interval

    Hello again. This is easy, I think I just didn't explain it clearly. What is the syntax to make a For 1 To 12 statement skip from 1 to 4 to 8 to 12 instead of 1 - 12 sequentially? I have tried other means, but they are very ineffective and easily messed up by users. Thanks.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by etangman
    Hello again. This is easy, I think I just didn't explain it clearly. What is the syntax to make a For 1 To 12 statement skip from 1 to 4 to 8 to 12 instead of 1 - 12 sequentially? I have tried other means, but they are very ineffective and easily messed up by users. Thanks.
    You need to add a Step clause to the For statement. Check the doco for details.

    I suspect you have your numbers a bit mixed up, though. From 1 to 4 is a jump of 3, then the others are jumps of 4. That may be what you want, but it's more likely that you will want all the steps the same size.

    Comment

    • etangman
      New Member
      • Jul 2007
      • 6

      #3
      Originally posted by Killer42
      You need to add a Step clause to the For statement. Check the doco for details.

      I suspect you have your numbers a bit mixed up, though. From 1 to 4 is a jump of 3, then the others are jumps of 4. That may be what you want, but it's more likely that you will want all the steps the same size.
      Thanks a lot, I'll see if I can't figure it out now.

      Comment

      • hariharanmca
        Top Contributor
        • Dec 2006
        • 1977

        #4
        Originally posted by etangman
        Thanks a lot, I'll see if I can't figure it out now.

        you can use


        Code:
        for i = 1 to 12 step 4
              Do some thing.....
        next i

        Comment

        • etangman
          New Member
          • Jul 2007
          • 6

          #5
          I asked the question in a new post.

          Comment

          Working...