I try to select the range that was union under one variable, but it fails.
Sub filter()
    'Clear prev result table
    Worksheets("main").Range("A3").CurrentRegion.Delete
    'Declare variable
    Dim selectedRows As Range
    Set selectedRows = Worksheets("contacts").Range("A1:B1")
    'Get total used range in contacts database
    numRows = Mid(Worksheets("contacts").UsedRange.Address, 9)
    For Each cell In Worksheets("contacts").Range("B1:B" & numRows)
        If cell.Value = Worksheets("main").Range("B1").Value Then
            'If true, push into array called selectedRows
            Set selectedRows = Application.Union(selectedRows, Worksheets("contacts").Range(cell.Address))
        End If
    Next
    selectedRows.Select '<------ fail here
    Copy Worksheets("main").Range("A3")
End Sub
The macro failed and error message said: Select method or Range class failed. What is wrong with my code?
 
     
     
    