title: Save .Find() function results to array Excel VBA
body: <p>I'd like to save all found numbers of rows containing the string into the array. I've written a function which works properly but I can't save its results into array. I might do it saving not as .Row values but .Address as strings however it's not my goal. I tried change array type from integer to long, but that does not work. Have u any idea what i should to do? What is the type of value .Row? By manual .Find() function return Range type, but I'm not sure that .Row value is also Range. If it is how to use this knowledge to solve the problem?
  My code:</p>
  
  <pre><code>Function findTesterRows(przypisFileName As String, testerName As String, tableSize As Integer) As Integer()
  Dim tableRange As String
      tableRange = "A2:L" &amp; tableSize
  Dim myArray() As Integer
  Dim i As Integer
      i = 0
  
  With Workbooks(przypisFileName).Worksheets("Sheet1").Range(tableRange)
      Set foundRow = .Find(What:=testerName, LookIn:=xlValues)
      If Not foundRow Is Nothing Then
          firstAddress = foundRow.Address
          Do
              i = i + 1
              Set foundRow = .FindNext(foundRow)
          Loop While Not foundRow Is Nothing And foundRow.Address &lt;&gt; firstAddress
      End If
  End With
  
  ReDim myArray(0, i)
  i = 0
  
   With Workbooks(przypisFileName).Worksheets("Sheet1").Range(tableRange)
      Set foundRow = .Find(What:=testerName, LookIn:=xlValues)
      If Not foundRow Is Nothing Then
          firstAddress = foundRow.Address
          Do
              MsgBox foundRow.Row
              myArray(i) = foundRow.Row '!!HERE IS THE PROBLEM!!
              i = i + 1
              Set foundRow = .FindNext(foundRow)
          Loop While Not foundRow Is Nothing And foundRow.Address &lt;&gt; firstAddress
      End If
  End With
  
  findTesterRows = myArray
  
  End Function
  </code></pre>