+ Reply to Thread
Results 1 to 6 of 6

how can VBA assist with 'releasing' memory?

  1. #1
    Forum Contributor
    Join Date
    12-18-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 365
    Posts
    108

    how can VBA assist with 'releasing' memory?

    Hello all,

    My team and I have an inventory report that has a variable length. (currently up to 50,000 lines or so.) Number of columns is fixed.

    In order to present it to our customer, we run a large amount of vlookups and such to pull data in from other Excel reports.
    Once that is completed, we run an number if/then statements for correcting some of the data.
    Our reports are growing in size (general increase in number of items on inventory) and as s result, my VBA is getting slower by the day.

    I know either of the 2 (vlookups and if/then statements) are unfortunately causing quite some issues on memory usage.
    Without having to disclose the entire VBA routine, are there general steps I can take to release my memory or speed things up a bit?

    - All scripts we are using start with Application.ScreenUpdating = False
    - I have tried Saving my file in between, in addition to saving at the end, but that actually did nothing to the memory usage and/or the time the VBA is running.

    I have read something about VBA Arrays as well as VBA Dim, but are they helpful, and how do I use them?
    And perhaps there is a method that can replace the if/then statements?

    any help is highly appreciated!
    Marijke

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: how can VBA assist with 'releasing' memory?

    This could take many posts and a multitude of speculative suggestions.
    Without the code it is impossible to give concise reasons for its deteriorating performance.
    torachan.

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: how can VBA assist with 'releasing' memory?


    Hi,

    avoid using useless Object variables (see With statement) and if you use some,
    set them to Nothing once there are no more necessary …

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: how can VBA assist with 'releasing' memory?


    Quote Originally Posted by Marijke View Post
    I have read something about VBA Arrays as well as VBA Dim, but are they helpful, and how do I use them?
    Use them as per the logic necessary …

    Among so many samples from this forum :

    Macro to Extract Matching Values into Columns

    VBA required to delimit cells with some rules applied on it

  5. #5
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: how can VBA assist with 'releasing' memory?

    Without code it is stumbling in the dark

    usually referencing another sheet in the same workbook is quicker than an external workbook

    Are the vlookups static once they have been calcualted? if yes change them to values

    applicatrion.calculation may also be worth looking at, so you only calculate when you need to

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: how can VBA assist with 'releasing' memory?

    Since you have Office 365... you can use something other than VBA, more suited to efficient use of memory (vertipaq engine).

    Replace VBA with using PowerQuery (ETL tool) and PowerPivot (reporting & analysis tool) to generate your report.

    However, as others have stated, without your code. It's bit hard to tell what the bottle neck is in your code.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

+ 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. [SOLVED] Thrashing VBA Memory Leaks. Memory Loop Problems. Uncleared Memory in .Match Range Object
    By Doc.AElstein in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-10-2017, 05:17 PM
  2. Releasing a COM add-in for Excel written in .NET?
    By OldManExcellor in forum Excel General
    Replies: 1
    Last Post: 01-14-2015, 09:33 AM
  3. shared workbook not releasing user
    By carsto in forum Excel General
    Replies: 0
    Last Post: 11-05-2007, 01:13 PM
  4. [SOLVED] not releasing excel objects..pl see this simple code.
    By asp newbie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-22-2006, 11:00 AM
  5. [SOLVED] Releasing reference to the Application object before exiting
    By cgr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-09-2006, 06:50 PM
  6. Releasing arrays?
    By SiriS in forum Excel General
    Replies: 3
    Last Post: 12-19-2005, 08:46 AM
  7. Excel Not releasing cells
    By sunstar in forum Excel General
    Replies: 3
    Last Post: 03-31-2005, 06:38 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