ultracyclist
Active Member
- Joined
- Oct 6, 2010
- Messages
- 271
- Office Version
- 365
- Platform
- Windows
I’m using the following macro to delete all rows that match my Array. Due to the number of different sites (>30), I would like to revise the array to keep all rows that match 2-3 criteria, plus any rows that have a blank value in column F, but remove all others.</SPAN>
Thoughts?
</SPAN>
Thanks,</SPAN>
Allen </SPAN>
Code:
</SPAN></SPAN>
Sub Row_Deletion_TEst()
Dim ndx As Long
Dim arrLike As Variant
Dim Found As Range
Dim ws As Worksheet
arrLike = Array("CX-CD-LQ", "CX-CD-CB", "CX-CD-BB", "ZZ-ID-ID", "ZZ-ID-MA", "CX-NP-NC","CX-NP-NC","CST1","CST2")
Application.ScreenUpdating = False
For Each ws In Sheets(Array("Sheet1"))
For ndx = LBound(arrLike) To UBound(arrLike)
Do
Set Found = ws.Columns("F").Find(arrLike(ndx), LookAt:=xlPart, MatchCase:=False)
If Not Found Is Nothing Then Found.EntireRow.Delete
Loop Until Found Is Nothing
Next ndx
Next ws
Application.ScreenUpdating = True
MsgBox "Row Delete Series Complete!"
End Sub
Thoughts?
</SPAN>
Thanks,</SPAN>
Allen </SPAN>