title: Matching rows from another sheet
body: <p>I am attempting to copy results from another sheet based on the cell values on the active worksheet. i.e loop through every element in array <i><b>"GWworkStations()"</I></b> and find a match in column B of <I><b>"Col List"</I></b> sheet, and then copy the corresponding values in <I><b>"C:E"</I></b> to an array <i><b>"MatchedEntries"</I></b> so I can copy them back to the active sheet.</p>
  
  <p>The code is returning empty for <I><b>"matchedRow"</I></b>, instead of reporting the row number. I am not getting an error.</p>
  
  <pre><code>dim MatchedEntries() as string
  dim GWworkStations() as variant
  number_of_rows = ActiveSheet.UsedRange.Rows.Count
  
  With ActiveWorkbook.Worksheets("New Sheet")
      GWworkStations() = range("B2:B" &amp; number_of_rows)
  End With
  
  ReDim MatchedEntries(1 To r) 'Size the array to hold the results.
  
  'for every cell that is not empty in GWworkStations(), search through column B of 'Col List ' sheet.
  
  For i = 1 To number_of_rows 
  
      'matchedRow = Empty
      On Error Resume Next 'Keep running if Excel MATCH function below doesn't find a match.
      If Not IsEmpty(Cells(i, 1)) Then
          matchedRow = Application.WorksheetFunction.Match(GWworkStations(i, 1), range("Col List!B:B"), 0)
  
          If matchedRow = Empty Then Debug.Print "Empty " &amp; matchedRow
  
          If IsEmpty(matchedRow) Then 'No match.         
              MatchedEntries(i, 1) = "" 'GWworkStations(i, 1) 
          Else
              'If GWworkStations(i, 1) = GWworkStations(i - 1) Then
  
              If IsNumeric(matchedRow) Then 'Match was found.
                  MatchedEntries(i, 1) = Application.WorksheetFunction.Index(range("List!C:E"), matchedRow, 1)
              Else 'MATCH function returned a non-numeric result.
                  MatchedEntries(i, 1) = ""
              End If 'IsNumeric(MatchedRow)
          End If 'IsEmpty(MatchedRow)
      Else
      End If
  Next i
  range("E2:G" &amp; number_of_rows) = MatchedEntries() 'Write the tag name  results out to range E:G.
  </code></pre>