Results 1 to 13 of 13

VBA - Full Speed Code Problems

Threaded View

  1. #1
    Registered User
    Join Date
    05-31-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003/2007
    Posts
    31

    VBA - Full Speed Code Problems

    Hi All,

    I have a reasonably long piece of code that conducts a lot of operations particularly on ranges.
    In short, it loops through all worksheets in a workbook and runs a lot of evaluate("index(functions))") on the .areas of a range object. This range object is made up of .specialcells that are constant text values. It's purpose is to perform operations on the text within each of these .areas and to store details of this in a (many rows) x (5 columns) array, which is then dumped into a new worksheet - or else into a specified worksheet if there is one that matches the sheet name I have given it. As far as I can tell, wherever possible I have used fully qualified range references.

    The problem I have now is that this code works fine on small sheets, or if I run the code for just one larger worksheet, or, if I put in stops and run it in sections - thus slowly loop through all the worksheets in a workbook.
    But if I just let the beast have at it, it starts dumping the change details array all over the shop in the other worksheets, erasing values from cells all over the place etc.

    I'm assuming this is something to do with execution rate, so how can I make sure an operation (for instance dumping all the change details to a sheet has finished), before it moves on to the next thing (for instance getting the next worksheet)?

    I have played with doevents (based on the limited info in the help file) but it doesn't seem to be helping....

    Any help would be much appreciated.


    Edit:
    One thought I had was that I can restructure away from a sub (which writes the change details to the sheet each time it is called for each ws in workbook) and make it a function that returns the array information, which is stored up in a variable in the calling sub and then just dumped once at the end...

    Edit 2:
    Another thought, at the moment it does a lot of:

    For each Area in range.areas
    'stuff
    next Area
    or
    For i = 1 to range.areas.count
    'stuff on range.areas(i)
    next i
    Is one of those preferable over the other? (they look about the same to me...)
    Last edited by Neutralizer; 09-05-2013 at 03:08 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to speed up this code
    By Surreall in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-12-2013, 10:26 AM
  2. Problems with PageSetup and Headers & Footers, step thru vs normal speed....
    By froztburn in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-27-2012, 12:05 PM
  3. Speed problems win Excel
    By _Scott_ in forum Excel General
    Replies: 1
    Last Post: 01-13-2006, 07:15 AM
  4. My VBA code works in the step though mode but not at full speed
    By Kelly in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-15-2005, 10:06 PM
  5. [SOLVED] Recurring Problems with Links with Full Path Names
    By JMcBeth in forum Excel General
    Replies: 2
    Last Post: 02-04-2005, 08:06 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