+ Reply to Thread
Results 1 to 3 of 3

nested Loop

  1. #1
    Forum Contributor
    Join Date
    08-08-2006
    Posts
    203

    nested Loop

    If itemQTY1 = 4 I want this result

    QTY 4
    QTY 3
    QTY 2
    QTY 1

    If itemQTY = 3

    QTY 3
    QTY 2
    QTY 1

    and so on.......


    Here is the idea, but this code doesnt work because of the multiple Do's

    Please Login or Register  to view this content.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    I think that part of your problem is that everytime you write one row and decrement itemQTY1, you then go back to the top of the column to start searching for the next cell.
    This kind of construct might be easier

    Please Login or Register  to view this content.
    I just realized that this is also a good example to show how to do the same thing without Selecting (i.e. faster). Declaring a range variable, myCell, and moving it as the Select was moving the Active Cell will achieve the same result without Selecting.
    Please Login or Register  to view this content.
    Last edited by mikerickson; 02-21-2008 at 07:12 PM.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Forum Contributor
    Join Date
    08-08-2006
    Posts
    203
    Excellent idea, as I hit myself in the head. I feel like such an idiot sometimes. Thank you, I will try it.

+ 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