Consulting

Results 1 to 4 of 4

Thread: For Loop Query

  1. #1

    For Loop Query

    Hello All,

    In the nested for loops, How it works, if I increment the counter of first "for loop" in the second "for loop". For example,

    for i = 1 to 10
    for j = 1 to 10
    ........
    i = i + 1
    next j
    next i

    I want to work with each i with each j. Is there any other way to compare each i with each j?

    Thanks for the explanation.

    Regards,
    Balu.

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    I don't think you would ever increment a loop counter within the loop like that. Maybe explain clearly what you want to achieve.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3

    To compare

    Hi John,

    I want to compare (for e.g.,) from 1 to 10 with 5 to 15.

    each value 1 with 5, 2 with 6, 3 with 7 .....etc.,

    Regards,
    Balu.

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    Something to try maybe ???

    [vba]
    For i = 1 to 10
    If A(i) = B(i+4) then
    ....
    Next i
    [/vba]

    Paul

Posting Permissions

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