+ Reply to Thread
Results 1 to 8 of 8

Macro gets "Run time error '7' out of memory" for ReDim Array

  1. #1
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Macro gets "Run time error '7' out of memory" for ReDim Array

    My code concatinates N discontiguous cells in a row and work for small data sets, but for a larger dataset (not sure where the breaking point is) I get a Run time error '7' out of memory here: ReDim myresult(1 To LR, 1 To LR)

    I need to run this on datasets of upword of 200,000 rows

    In searching for a solution many forum threads advised adding Application.EnableEvents = False but it did not help

    Thanks

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by capson; 12-10-2014 at 12:18 PM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro gets "Run time error '7' out of memory" for ReDim Array

    Please Login or Register  to view this content.
    The max the second dimension can take is the max number of columns-16834.
    If you are over this limit, you will get out of memory.
    Even if, with this limit, you will get another error.
    Imagine multiplying the no of rows times 16834, excel can not handle it.
    Last edited by AB33; 12-10-2014 at 12:12 PM.

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Macro gets "Run time error '7' out of memory" for ReDim Array

    Why are you declaring the second dimension as 1 to LR rather than 1 to 1 anyway?
    Remember what the dormouse said
    Feed your head

  4. #4
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: Macro gets "Run time error '7' out of memory" for ReDim Array

    Thank AB33, I added
    Please Login or Register  to view this content.
    And then
    Please Login or Register  to view this content.
    And this fixed my proplem, many thanks!!

    I updated the code to reflect this fix
    Last edited by capson; 12-10-2014 at 12:24 PM.

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Macro gets "Run time error '7' out of memory" for ReDim Array

    But you're only using 1 column...

  6. #6
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: Macro gets "Run time error '7' out of memory" for ReDim Array

    Hello romperstomper, I am kind of at the limits of my understanding, do you mean I should just use
    Please Login or Register  to view this content.
    Instead of
    Please Login or Register  to view this content.

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Macro gets "Run time error '7' out of memory" for ReDim Array

    Close:
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: Macro gets "Run time error '7' out of memory" for ReDim Array

    I will use that Thank you

+ 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. Help With "Run-time Error '7' - Out of Memory"
    By jtsanabria in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-30-2014, 09:59 AM
  2. [SOLVED] Array size unknown until the first "loop", how to correction dim/redim the array
    By menichols74 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-15-2013, 10:04 AM
  3. [SOLVED] Macro Array "Out of memory" any way around this?
    By Hyflex in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-30-2011, 07:02 AM
  4. Array loop producing error "Run time error '1004'"
    By jeskit in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-06-2011, 08:56 AM
  5. Run-Time error "7" out of memory
    By jpf777777 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-14-2009, 09:22 AM

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