Display MoreGlad we are progressing ...
To take into account your two latest requests ...
CodeDisplay MoreSub RemoveAllCodes() Dim lastrow As Long, lastrowK As Long, c As Range, rngK As Range Dim res As Variant lastrow = Sheets("Import Data").Cells(Rows.Count, 1).End(xlUp).row lastrowK = Sheets("Drivers").Cells(Rows.Count, 11).End(xlUp).row Set rngK = Sheets("Drivers").Range("K35:K" & lastrowK) Application.ScreenUpdating = False Application.Calculation = xlCalculationManual For Each c In rngK res = Application.Match(c.Value, Sheets("Import Data").Range("F1:F" & lastrow), 0) If Not IsError(res) Then Sheets("Import Data").AutoFilterMode = False ' ''''''''''MAKE SURE TO ADJUST THE RANGE TO YOUR ACTUAL SITUATION ''''''''''''''''''''''''''' With Sheets("Import Data").Range("A1:M" & lastrow) .AutoFilter Field:=6, Criteria1:="=" & c.Value .Offset(1, 0).Resize(lastrow - 1).SpecialCells(xlCellTypeVisible).EntireRow.Delete End With End If Next c ' Back to Normal Sheets("Import Data").AutoFilterMode = False Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic MsgBox " All Codes have been Removed ..." End Sub
Hope this will be fine ...
Hi,
That is absolutely perfect, thank you.