View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen Per Jessen is offline
external usenet poster
 
Posts: 1,533
Default Delete all rows except...

Try this:

Sub RemoveRows()
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With

LastRow = Range("A" & Rows.Count).End(xlUp).Row
For r = LastRow To 2 Step -1 'Headings in row 1
If Range("A" & r).Value < "AWH98228" _
And Range("A" & r).Value < "AWL99467" Then
Rows(r).Delete
End If
Next
With Application
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
End Sub

Regards,
Per

"joshman" skrev i meddelelsen
...
I receive a weekly report & have been asked to delete all rows except
for two particular rows. Here are the two criteria which are in column
A cells:

AWH98228 and AWL99467

Can anyone offer help?

Thanks