+ Reply to Thread
Results 1 to 4 of 4

Rotating a square, very slow

  1. #1
    Registered User
    Join Date
    03-17-2011
    Location
    UK
    MS-Off Ver
    Excel 2010, 2007, 2003
    Posts
    11

    Rotating a square, very slow

    I'm working on using excel to program a board game (I know it's outside the usual function but it should be capable of it)

    As part of the program I need to rotate a 15 by 15 tile. However most of the cells will be the same irrespective of the particular tile and orientation.
    The centre 7x7 of the tile can either spin or not (i have no preference but not spinning it seems faster).
    I have 2 codes that work but they're both very slow. Am I missing something obvious?

    The tile I am rotating is in ("DL50:DZ64")
    I am using the space ("EE50:ES64") to hold a spare copy while rotating

    Faster code
    Please Login or Register  to view this content.
    simpler to change but slower Code
    Please Login or Register  to view this content.
    With the second code, StartTile and EndTile are only called twice or once respectively so they possibly don't need to be initiated as variables however that would lose some of its flexibility but even without that it takes several seconds to run. Am I missing something obvious?

  2. #2
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Rotating a square, very slow

    Why are you using the .Value(11)? That is what is bogging you down. I think just changing your lines to .Copy will achieve the same result and it seems faster on my system. e.g.
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

  3. #3
    Registered User
    Join Date
    03-17-2011
    Location
    UK
    MS-Off Ver
    Excel 2010, 2007, 2003
    Posts
    11

    Re: Rotating a square, very slow

    Quote Originally Posted by Pauleyb View Post
    Why are you using the .Value(11)?
    In essence because Iwas taught never to use copy when you could use value, but I see now that value(11) is a lot heavier than value. That .copy method just took the time right down less than 1/3 what it was. Cheers.

    I'll remove the Value(11) elsehwere as well, it should speed a lot of things up.

  4. #4
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Rotating a square, very slow

    Oh yes, generally what you say is true, but I think you see that is true for a pure .Value. Now, if you don't care about the formatting being copied, you should use just .value.

    BTW, I did a quick speed comparison by running each solution 100 times. The .value(11) took 61.58 seconds, and the .copy took 3.36 seconds, so roughly 1/18.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro is running real slow and makes navigating the worksheet really slow after execution.
    By MichWolverines in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2013, 04:29 PM
  2. [SOLVED] convert square meters to square feet
    By mroberts in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-07-2013, 12:51 PM
  3. Replies: 3
    Last Post: 08-19-2009, 08:53 AM
  4. how to center a square plot area in a square chart
    By xppuser in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 03-11-2006, 04:20 AM
  5. [SOLVED] Regression Output -- R Square versus Adjusted R Square
    By Bonnie in forum Excel General
    Replies: 1
    Last Post: 10-24-2005, 08:05 PM

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