You could do that or you could use this modified version:
Option Explicit
Public Sub FixBaseData()
Dim lastRow As Long
Dim thisRow As Long
Dim lookupTable As Object
Dim lookupKey As Variant
Dim ws As Worksheet
' Get a reference to the worksheet
Set ws = Worksheets("Base Data")
' Create the lookup table
Set lookupTable = CreateObject("Scripting.Dictionary")
' Find the last row of data
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
' Temporarily turn off the screen updating
Application.ScreenUpdating = False
' Process from the latest record (at the bottom) to the oldest (at the top)
For thisRow = lastRow To 2 Step -1
' If the result isn't "Passed" then delete the row
If ws.Cells(thisRow, "I").Value <> "Passed" Then
ws.Cells(thisRow, "A").EntireRow.Delete xlShiftUp
Else
' Create a key for the lookup table based on the first and second names
lookupKey = ws.Cells(thisRow, "E").Value & " " & ws.Cells(thisRow, "F").Value
' Have we seen this name already?
If lookupTable.Exists(lookupKey) Then
' Yes - delete the row
ws.Cells(thisRow, "A").EntireRow.Delete xlShiftUp
Else
' No - add the name to the lookup table
lookupTable.Add lookupKey, lookupKey
End If
End If
Next thisRow
' Restore screen updating
Application.ScreenUpdating = True
End Sub
WBD
Bookmarks