D
dfbriles
I have the following code that will delete all rows that DO NOT contai
the value "11327" in column A. I need to expand this code to includ
roughly 40 values.
Here is what I have:
Sub delete_It()
Dim MyRange1 As Range
Dim MyRange As Range
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A1:A" & lastrow)
For Each c In MyRange
If InStr(1, UCase(c.Value), "11327", 0) Then
If MyRange1 Is Nothing Then
Set MyRange1 = c.EntireRow
Else
Set MyRange1 = Union(MyRange1, c.EntireRow)
End If
End If
Next
If Not MyRange1 Is Nothing Then
MyRange1.Delete
End If
End Sub
Any help will be greatly appreciated.
Thanks,
DF
the value "11327" in column A. I need to expand this code to includ
roughly 40 values.
Here is what I have:
Sub delete_It()
Dim MyRange1 As Range
Dim MyRange As Range
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A1:A" & lastrow)
For Each c In MyRange
If InStr(1, UCase(c.Value), "11327", 0) Then
If MyRange1 Is Nothing Then
Set MyRange1 = c.EntireRow
Else
Set MyRange1 = Union(MyRange1, c.EntireRow)
End If
End If
Next
If Not MyRange1 Is Nothing Then
MyRange1.Delete
End If
End Sub
Any help will be greatly appreciated.
Thanks,
DF