Results 1 to 13 of 13

Curious about why one macro runs so much quicker than another

Threaded View

  1. #12
    Registered User
    Join Date
    01-28-2013
    Location
    Manchester, England
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2010
    Posts
    50

    Re: Curious about why one macro runs so much quicker than another

    Stan, thank you so much for doing that, it's fantastic!

    It's such an elegant (if VBA can be described that way) solution to the problem and a dynamic approach that I've never understood before. I expect to many seasoned VBA guys it's second nature, but I feel like a light bulb has come on haha.

    I hadn't realised that the array can be populated by simply stating a = Range("A2:H" & lr) and conversely written back by to the cells in the same manner. I also thought that the array sizes had to be declared initially rather than declaring the arrays as variant. This really helps me to understand their use in simplifying some of my convoluted coding.

    ReDim is something that I haven't come across before so I will read up on that too.
    One thing from my basic understanding of arrays is that by default they start from position 0 unless specified, like in your ReDim line for array 'b'.
    Does the 'a' array run from 0-7 and not 1-8? I had thought that the Ubound function also counted from position 0?
    I assume they mustn't do because the loops cycle through the arrays without missing the last column when they both use 'ii' variable as the position across the array.

    Again, thank you very much for taking the time to help me understand this, I really appreciate it and have learned a awful lot from this one thread.
    Chris
    Last edited by bodhi808; 05-01-2013 at 06:13 AM.

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