Good afternoon all
I have a workbook with several sheet... two of which are called 'Data' and 'Add Driver', both have headers.
I'm looking at comparing the information in column B in both sheets,,, when it finds a duplicate I'm looking at deleting the row in the sheet 'Add Driver', the ranges, including headers, start in Row 8 on the 'Data sheet and Row 1 on the 'Add Driver Sheet'
I have been working with this macro but the closest I can get it, is for it to delete everything, except the headers in the 'Add Driver' sheet
Any help would be much appreciated
Many thanks
JT
Sub Add_Driver()
Dim LR As Integer, x As Integer
UnprotectMain
LR = ThisWorkbook.Sheets("Add Driver").Cells(Rows.Count, 2).End(xlUp).Row
Application.ScreenUpdating = False
For x = LR To 2 Step -1
If Application.WorksheetFunction.CountIf(Sheets("Data").Range("B9:B5000"), Sheets("Add Driver").Cells(x, 2).Value) = 0 Then
Sheets("Add Driver").Rows(x).EntireRow.Delete
End If
Next x
Application.ScreenUpdating = True
End Sub
Bookmarks