+ Reply to Thread
Results 1 to 6 of 6

Creating a "matrix" of Rectangles

  1. #1
    Registered User
    Join Date
    11-16-2009
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Creating a "matrix" of Rectangles

    I am trying to create a visual map for our warehouse and I am struggling with my next for loop. I am actually having a few problems, but I will just start with the first one. So I am creating racks of nine locations. In each row there is 14 racks, this is COMPLETE. Now I am trying to get this to have 30 identical rows. When I add my next for loop to make the other rows, I either get everything going straight accross, or everything cascading (top left, to bottom right). Here are two codes, the first is what I have that works and creates one row, the second is an example of what I am trying, and failing, to do. Thanks a lot in advance!!

    Working 1 row:
    Please Login or Register  to view this content.
    Not working multiple rows (shows going straight across, not cascading):
    Please Login or Register  to view this content.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Creating a "matrix" of Rectangles

    try

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    11-16-2009
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Creating a "matrix" of Rectangles

    Worked great. I was trying to the same thing with a xTemp variable so I am glad to see I was close! I will leave this thread open because I think there will be problems in my next step, but I have a little programming until I get there. I really appreciate it, great community here!

  4. #4
    Registered User
    Join Date
    11-16-2009
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Creating a "matrix" of Rectangles

    Okay so I have all of the code working now, but it is VERRRRYYYY slow, which I figured it would be. This is the second macro that now fills in the rectangle matrix. Both work, but is there any way I could optimize the speed of my crazy long for loops? This is more of a logic problem than code related. Anyways, here are BOTH macros. Macro666(), named for a reason #@$%!, creates your rectangles, Macro8() looks through the data. The FLoD (for loop of death) is actually MUCH larger, this was just a sample of the data data range and rectangles to compare to.

    Please Login or Register  to view this content.
    Looking at the code briefly, I don't think Macro8 is very efficient, but even then it is still really slow. Would it help to break these into multiple smaller loops? Anyone have any suggestions, I know I am asking a lot of Excel, but this would be great if we could use this.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Creating a "matrix" of Rectangles

    I have no way to test this ...
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Registered User
    Join Date
    11-16-2009
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Creating a "matrix" of Rectangles

    Code works and it's about 2x faster, GREAT! I just had to change some things where the source was located. What about running multiple for loops of smaller values, would this speed things up even more? So rather than run two for loops that run from 1 To 400 and 1 To 600, can excel process three or four smaller for loops faster? Anyone else have any ideas to increase the speed? Working code:

    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)

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