How do I Delete Rows on Range Criteria for Column A Cells Not Equal to specific values ?
Hi J.P.,
Am Sat, 25 Apr 2015 09:07:13 -0700 (PDT) schrieb JeanPierre Charron:
'How do I create a Range of rows to delete for Criteria1 Not Equal to "F1PPM60601" OR F1PPM60549" Etc...
try:
Sub DeleteRows()
Dim LRow As Long, i As Long
Dim varData As Variant
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
With Sheets("Invoices")
LRow = .Cells(Rows.Count, 1).End(xlUp).Row
varData = .Range("A2:A" & LRow)
For i = UBound(varData) To LBound(varData) Step -1
If varData(i, 1) < "F1PCM60125" And _
varData(i, 1) < "F1PCM60104" Then
.Rows(i + 1).Delete
End If
Next
End With
With Application
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub
Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
|