title: Excel macro - read data from array
body: <p>How do you read the data from a dynamic array out? </p>
  
  <pre><code>ReDim idx(1 To nItemsToPick)
  ReDim varRandomItems(1 To nItemsToPick)
  For i = 1 To nItemsToPick
      Do
          booIndexIsUnique = True
          idx(i) = Int(nItemsTotal * Rnd + 1)
          For j = 1 To i - 1
              If idx(i) = idx(j) Then
                  booIndexIsUnique = False
                  Exit For
              End If
          Next j
          If booIndexIsUnique = True Then
              Exit Do
          End If
      Loop
      varRandomItems(i) = rngList.Cells(idx(i), 1)
  Next i
  </code></pre>
  
  <p>Thank you!</p>