Consulting

Results 1 to 5 of 5

Thread: Solved: For loop, counter

  1. #1
    VBAX Regular
    Joined
    Aug 2008
    Posts
    48
    Location

    Solved: For loop, counter

    Hi !

    What is the syntax in a for loop for the counter to move by an specified increment i.e. -2, +2 as opposed to +1 ?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    For i = start to end Step increment
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Aug 2008
    Posts
    48
    Location
    As in.. something like this ?

    For plotprice = ref_price To price + 2

    or

    For plotprice = price To ref_price - 2

    ?

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    No,

    [vba]

    For plotprice = ref_price To price Step 2

    or

    For plotprice = price To ref_price Step - 2
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Regular
    Joined
    Aug 2008
    Posts
    48
    Location
    got it... thanks a bunch...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •