Hi,
I'm trying to delete any rows that match any name found within another range.
I've used the basis of a code that leaves any column if its in the range but struggling.
I think this is the line
that I need to amend but not sure how to write the If statement for it
I'm trying to delete any rows that match any name found within another range.
I've used the basis of a code that leaves any column if its in the range but struggling.
VBA Code:
Dim NTS_LR As Long, NTS_LC As Long
Dim NTS_Name As Variant
With Sheets("NonTechStaff")
NTS_LR = .Cells(.Rows.Count, 2).End(xlUp).Row
NTS_Name = .Cells(2, 2).Resize(NTS_LR, 2).Value
End With
Dim TempLR
TempLR = Cells(Rows.Count, 1).End(xlUp).Row
For Row = TempLR To 5 Step -1
x = ""
On Error Resume Next
x = WorksheetFunction.Match(Cells(Row, 1), NTS_Name, 0)
If Not IsNumeric(x) Then Rows(Row).EntireRow.Delete
Next Row
I think this is the line
Code:
If Not IsNumeric(x) Then Rows(Row).EntireRow.Delete