title: VBA code error when array value exceeds 255 characters
body: <p>I have extracted the following code snippet from a project I am working on : </p>
  
  <pre><code>Sub testData()
  
  Dim dataRange As Range
  Set dataRange = Range("B2").Offset(1, 0).Resize(, 3)
  
  Dim data As Variant
  data = dataRange.Value2
  
  Dim i As Integer
  For i = 1 To UBound(data)
      Dim datarow As Variant
      datarow = WorksheetFunction.Index(data, i, 0)
  
      For j = 1 To dataRange.Count
          MsgBox "The data is " &amp; datarow(j)
      Next j
  Next i
  
  End Sub
  </code></pre>
  
  <p>Values in Cells B3, C3 and D3 in this example might be text, date, number.</p>
  
  <p>This code executes fine as long as the text contents of each cell in the range specified does not exceed 255 characters. If greater, the code will throw an error at the line : </p>
  
  <pre><code>datarow = WorksheetFunction.Index(data, i, 0)
  </code></pre>
  
  <p>I have read about various String limits in Excel (using 2010) for which there are various workarounds. However given the use of datatype Variant, I am uncertain how one can check for the existence of a text value exceeding these limits.</p>
  
  <p>Is anyone able to suggest how one might adjust the code to allow for greater text length than 255 characters?</p>