View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
J.W. Aldridge J.W. Aldridge is offline
external usenet poster
 
Posts: 425
Default Delete Rows except


one more thing....

If I wanted the macro to start at A2 (instead of A1)?
(row a1 has my headers)



Sub Apples()
Dim LastRow As Long
Dim RowNdx As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
'<change column letter if desired
For RowNdx = LastRow To 1 Step -1
'<change '1' to ending row if desired
If Left(Cells(RowNdx, "A"), 4) < "PCPB" Then
Rows(RowNdx).Delete
End If
Next RowNdx

End Sub