title: Copying rows from one Excel sheet to another based on cell value
body: <p>I'm looking for a simple excel macro that can copy a row from one sheet to another within excel based upon having a specific number/value in the cell. I have two sheets. One called "master" and a sheet called "top10". </p>
  
  <p>Here is an example of the data.  </p>
  
  <p><img src="https://i.stack.imgur.com/LU0OB.png" alt="data representation"></p>
  
  <p>Here's the macro I'm trying to use: </p>
  
  <pre><code>Sub MyMacro()
  Dim i As Long, iMatches As Long
  Dim aTokens() As String: aTokens = Split("10", ",")
  For Each cell In Sheets("master").Range("A:A")
      If (Len(cell.Value) = 0) Then Exit For
          For i = 0 To UBound(aTokens)
              If InStr(1, cell.Value, aTokens(i), vbTextCompare) Then
                  iMatches = (iMatches + 1)
                  Sheets("master").Rows(cell.Row).Copy Sheets("top10").Rows(iMatches)
              End If
          Next
  Next
  End Sub
  </code></pre>
  
  <p>I'm sure I'm doing something extremely silly that's causing this not to work. I can run the macro itself without any error, but nothing gets copied to the sheet I'm looking to compile.</p>