Hi All,
I am trying to do the following :
I have the following code:
The code does not seem to function, I am looking for a way to specify the range to match and delete - where do I add that ?
Thanks
I am trying to do the following :
- VBA to lookup a value from a particular cell
- Match these values in a particular column in specified sheets
- Delete all rows from the sheet if the value do not match
I have the following code:
Sub Delete()
Sheets("TEST").Select
Dim List As Variant
Dim LR As Long
Dim r As Long
List = Worksheets("Sheet1").Cells(1, "B").Value
LR = Range("B" & Rows.Count).End(xlUp).Row
For r = LR To 1 Step -1
If IsError(Application.Match(Range("B" & r).Value, List, False)) Then
Rows(r).Delete
End If
Next r
End Sub
The code does not seem to function, I am looking for a way to specify the range to match and delete - where do I add that ?
Thanks