+ Reply to Thread
Results 1 to 4 of 4

Nested FOR loop from multiple FOR loops

  1. #1
    Registered User
    Join Date
    08-14-2012
    Location
    California
    MS-Off Ver
    Excel for Mac 2011
    Posts
    2

    Nested FOR loop from multiple FOR loops

    I am completely new to the world of VB... and need some help resolving a "Compile Error: Procedure too large" problem.

    I have a spreadsheet with two (2) columns of numbers: 1) Store # and 2) # of codes. I need to replicate the Store Number (Column 1) in a separate column as many times as the Number Of Codes (value in Column 2). My actual spreadsheet has 448 rows of data which must be replicate din this way.

    Sample Columns:

    StoreNumber Number of codes
    29 75
    67 75
    71 125

    Here's what I have created 448 times in a single Macro:

    Please Login or Register  to view this content.
    How do I create a nested FOR loop that will cycle through all 448 rows and produce approximately 44,625 cell values representing the Store Numbers replicated as many times as required by the Number of Codes column?

    I really appreciate your help!

    Chilton

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Nested FOR loop from multiple FOR loops

    Is this what your wanting?

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  3. #3
    Registered User
    Join Date
    08-14-2012
    Location
    California
    MS-Off Ver
    Excel for Mac 2011
    Posts
    2

    Re: Nested FOR loop from multiple FOR loops

    Mike,

    You are awesome! Thanks so much. Can I ask you a favor? Can you add comments to each line telling me what it's doing? As I said, I am COMPLETELY new to VB and would like to understand the syntax better as I use it to improve my productivity.

    Thanks Again!

    Chilton

  4. #4
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Nested FOR loop from multiple FOR loops

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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