title: Getting "Out of Memory" error with small array in loop
body: <p>Somehow I'm getting an "out of memory" error with this array.  It's a sub to get the string from a cell, split it, and use the results to preselect a listbox.  There are only about 10 items in the listbox and I clear the array afterwards.</p>
  
  <p>The sub gets called from inside a loop that searches through rows (i) to see if the text matches that in the userform textbox.  If it does this gets run.</p>
  
  <p>The weird thing is I don't get the error when the sub runs.  I only get it after I unload the userform.</p>
  
  <pre><code>Private Sub GetWords (i As Long)
  Dim WrdArray() As String
  Dim text As String
  Dim listnum As Long
  Dim wordnum As Long
  
  text = Sheets("Sheet1").Cells(i, "A").Value
  
  WrdArray() = Split(text, ", ")
  For wordnum = LBound(WrdArray) To UBound(WrdArray)
  
      For listnum = 0 To Me.ListBox1.ListCount - 1
          If WrdArray(wordnum) = Me.ListBox1.list(listnum) Then
              Me.ListBox1.Selected(listnum) = True
          Else
          End If
      Next
  
  Next
  Erase WrdArray()
  End Sub
  </code></pre>