Essentially the code is suppose to match the names in a column then go to the last call column or last visit column find if they have been contacted in the last 7 days and paste it into the sheet named after the person. So all the jacksons visited in the past 7 days would be copied to the jacksons sheet. Thanks for the help. But I am getting a mismatch error.
Code:
Sub dateofvisit()
Dim lastrow As Long
Application.ScreenUpdating = False
Application.Calculation = xlManual
sheetlist = Array("Jackson", "Michael", "Bieber", "Nicole", "Reina", "TimC")
strsearch =Array("Jackson", "Michael", "Bieber", "Nicole", "Reina", "TimC")
For Z = LBound(strsearch) To UBound(strsearch)
For i = LBound(sheetlist) To UBound(sheetlist)
Sheets("Sheet1").Activate
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
dbate = "Date of Last Call"
ddate = "Date of Last visit"
For x = lastrow To 5 Step -1
If ActiveSheet.Cells(x, Application.VLookup(strsearch, Range("A5:S3000"), 17, False)) >= DateAdd("d", -7, Now) _
Or ActiveSheet.Cells(x, Application.VLookup(strsearch, Range("A5:S3000"), 16, False)) >= DateAdd("d", -7, Now) Then
Rows(x).Copy Sheets(sheetlist(i)).Cells(Rows.Count, 1).End(xlUp)(2)
End If
Next x
Next i
Next Z
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub