Note that there are some explanatory texts on larger screens.

plurals
  1. POVBA Writing Array to Range Causing Run-Time Error '7': Out Of Memory
    primarykey
    data
    text
    <p><strong>The Task</strong></p> <p>I'm working on a VBA project wherein I store the data from a sheet in a <code>Variant Array</code>, do a bunch of calculations with the data in the <code>Array</code>, store the results of those computations in a few other <code>Arrays</code>, then finally I store all the "results arrays" in another <code>Variant Array</code> and write that array to a range in a new sheet. </p> <p>Note: this process has been working fine ever since I first wrote the procedure.</p> <p><strong>The Issue</strong></p> <p>After a very minor logic change, my final <code>Array</code> will no longer write to the specified range. I get <code>Run-time error '7': Out of memory</code> when I try. I changed the logic back in case that was my issue, but I still get the error. </p> <p>After doing some research, I tried to erase all the arrays (including the one containing all the sheet data) before writing to the range, but that didn't work either. I've checked Task Manager and that shows my RAM as having a lot of free space (almost 6K MBs available and over 1k Mbs "free"). (Task Manager shows the Excel process as using around 120 MBs.)</p> <p><strong>The Code (Snippet)</strong></p> <pre><code>Dim R As Range Dim ALCount As Long Dim All(5) As Variant Dim sht As Worksheet Dim Arr1() As Long Dim Arr2() As Date Dim Arr3() As Date Dim Arr4() As Long Dim Arr5() As String All(1) = Arr1 All(2) = Arr2 All(3) = Arr3 All(4) = Arr4 All(5) = Arr5 Set R = sht.Cells(2,1) R.Resize(ALCount - 1, 5).Value = Application.Transpose(All) </code></pre> <p><strong>More Details</strong></p> <pre><code>My device: Win 7 64-Bit Excel: 2010 32-Bit File Size: &lt;20 MBs Macro Location: Personal Workbook Personal WB Size: &lt; 3 MBs </code></pre> <p><strong>Edit: Array Size: 773x5</strong></p> <p>Any thoughts on why this might be happening?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload