+ Reply to Thread
Results 1 to 6 of 6

Out of memory-Converting Formulas to Values

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Out of memory-Converting Formulas to Values

    This routine worked just fine on XLS workbooks, but not in XLSB workbooks. It gives me an "out of memory" error.
    Please Login or Register  to view this content.
    Since I have to do this daily, for about 20 sheets each for about 15 workbooks, what's the fastest way I could accomplish turning formulas to values?

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Out of memory-Converting Formulas to Values

    Convert the range values to an array then print the array back to the sheet
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Out of memory-Converting Formulas to Values

    I'm not sure I understand how to do that.

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Out of memory-Converting Formulas to Values

    Here's an example. Open a new workbook and paste the code in a standard module and run.

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Out of memory-Converting Formulas to Values

    Wow! I like that. With the test material the code below works, but I can't try it on my full data until the morning. But, if I'm having memory problems just converting the active range to values, won't the array cause the same problem?
    Please Login or Register  to view this content.
    Also, afterwards should I set arr = Nothing?, or is there no overhead with this method?

  6. #6
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Out of memory-Converting Formulas to Values

    I have seen arrays use up GB of RAM on my system and so I think you should be fine. If not, use smaller ranges.

    From what I have read and seen in practice, if you are going to continue doing other activities in the subroutine then you may want to delete the array after its purpose is complete.

    Please Login or Register  to view this content.
    Chip Pearson has this to say about the matter "You can change the size of a dynamic array, but not the data type. When you Erase a dynamic array, the memory allocated to the array is released. You must ReDim the array in order to use it after it has been Erased."

    abousetta

+ Reply to Thread

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