title: Storing a worksheet in an array and working on it
body: <p>The below code deletes rows which do not match my criteria. It takes around 52 minutes as my rows exceed 1,68,000 and this will keep increasing.</p>
  
  <p>I was using filters to reduce the data. That isn't an option any more. I have to delete rows based on my date compare range. It seems an array is my last resort, but I do not know how to store my worksheets in an array and work on them.</p>
  
  <p>How do I store my worksheet in an array and work on it?</p>
  
  <pre><code>' to delete data not meeting criteria
  Worksheets("Dashboard").Activate
  n1 = Range("n1")
  n2 = Range("n2")
  Worksheets("Temp Calc").Activate
  lastrow = Cells(Rows.Count, 1).End(xlUp).Row
  For z = lastrow To 2 Step -1
       If Cells(z, 6).Value = "CNF" Or Cells(z, 4).Value &lt;= n1 Or Cells(z,3).Value &gt;= n2 Then
            Rows(z).Delete
       End If
  Next z
  </code></pre>
  
  <p>This is something basic.</p>
  
  <pre><code>Dim arr1(),  dim arr2() as variant
  lastrow  = cells(Rows.count,1).End(XlUp).Row
  lastcol = cells(1,column.count).End(xlRight).Column
  arr1(lastrow,lastcol) &lt;- I dont know if this is correct. 
  &lt;------How do I copy/paste my data into the array? -----&gt;
  
  &lt;This is what I came up with for deleting what I dont need.&gt;
  For x=lastrow to 2 Step -1
  If arr1(x,6)&lt;&gt;"" or arr1(x,6)&lt;&gt;"CNF" And arr(x,4)&gt;=n1 And arr(x,3)&lt;=n2 then
  For k = lastrow to 2 
  &lt;I dont know how to delete rows in an array.
  rows(x).delete ?
  </code></pre>