Hello,

I am trying to find a way to use a macro that will filter column O on the different name I have.
Let's say that it will filter on "David" then it will copy from column A to P and paste in a new sheet.

I have the following code:

Sub CopyRange()
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Sheets("Data").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim response As String
    response = InputBox("please enter the name to filter.")
    Sheets("Data").Range("O1:O" & LastRow).AutoFilter Field:=1, Criteria1:=response
    Sheets("Data").Range("A2:M" & LastRow).SpecialCells(xlCellTypeVisible).Copy Sheets("Data").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
    If Sheets("Data").FilterMode Then Sheets("Data").ShowAllData
    Application.ScreenUpdating = True
End Sub