+ Reply to Thread
Results 1 to 4 of 4

help to create loop in a defined range

  1. #1
    Registered User
    Join Date
    12-10-2009
    Location
    Baku
    MS-Off Ver
    Excel 2007
    Posts
    10

    help to create loop in a defined range

    hi all
    i am newbie in Excel VBA
    i created list in Excel and i wrote into (a1 cell-income, b1 cell-expence, c1 cell-kredit and d1 cell-debet)
    i enter a2 cell income (for ex:1000) and b2 cell expence (for ex: 100)
    and I give condition in VBA that if income greater than expence then VBA writes a2.value-b2.value into d2 cell
    else if expence greater than income then it writes b2.value-a2.value into c2 cell
    but i only define this one row (for ex: c2, a2. b2. d2)
    i would like to assign it the rows as long as i want
    that is i would like to create loop
    (for ex: a(i), b(i) and so on

    here is code

    pls help me i very need this code
    thanks beforehands
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by azegurb; 12-10-2009 at 03:31 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: help to create loop in a defined range

    Hello azegurb,

    This macro will size your range based on the last entry in column "A". It will then loop through each cell and apply the calculations.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    12-10-2009
    Location
    Baku
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: help to create loop in a defined range

    Thank you very much
    you helped me great Leith Ross
    Let God Helps you

  4. #4
    Registered User
    Join Date
    12-10-2009
    Location
    Baku
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: help to create loop in a defined range

    can you explain me what is IIf(RngEnd.Row ......
    what is IIf here
    i didn't understand
    if possible
    thanks for attention

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1