title: Why does my code only work with small amount of data?(run-time error 1004-VBA)
body: <p>I am running a code that lists me every word that occurs in a given column and the number of times each word occurs(the cells contain text). If I try to run it for my C column that contains larger texts, I get a 'run_time error 1004' in line: 'Cells(MyRow, 7).Value = K'. How could I modify this code to make it work on large amount of data?</p>
  <pre><code>Sub WordCount()
  Dim Rng As Range, Dn As Range, oMax As Double, K As Variant, Msg As String, vWords As Variant, myWord As Variant
  Set Rng = Range(Range(&quot;B2&quot;), Range(&quot;B&quot; &amp; Rows.Count).End(xlUp))
  With CreateObject(&quot;scripting.dictionary&quot;)
      .CompareMode = vbTextCompare
          For Each Dn In Rng
          vWords = Split(Dn.Text, &quot; &quot;)
              For Each myWord In vWords
                  If Not .Exists(myWord) Then
                  .Add myWord, 1
              Else
                  .Item(myWord) = .Item(myWord) + 1
              End If
              Next
          Next
  oMax = Application.Max(Application.Transpose(.Items))
  MyRow = 2
  For Each K In .keys
      If .Item(K) = oMax Then
          Msg = Msg &amp; K &amp; &quot;,&quot;
      End If
      Cells(MyRow, 8).Value = .Item(K)
      Cells(MyRow, 7).Value = K
      MyRow = MyRow + 1
  Next K
  End With
  End Sub
  </code></pre>