ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   do not delete rows in a list. (https://www.excelbanter.com/excel-programming/386462-do-not-delete-rows-list.html)

steven

do not delete rows in a list.
 
Hello

unlike most of the post I'd lke the code to a macro that does not delete
rows. To be more specific I'd like my macro to check the values of column E
of the list, for 3 criteria, and if any of the three exist then to KEEP these
rows and delete all the others.


I guess it would have to be a macro similar to the one found at
http://www.rondebruin.nl/delete.htm only instead of deleting the rows that
meet the criteria, keep these rows and delete the rest.

any help apreciated

Steven.


Don Guillett

do not delete rows in a list.
 
one way
Sub deleteifnot()
lr = Cells(Rows.Count, "a").End(xlUp).Row
For i = lr To 4 Step -1
If Cells(i, "a") < "a" And _
Cells(i, "a") < "b" And _
Cells(i, "a") < "c" Then Rows(i).Delete
Next i
End Sub

--
Don Guillett
SalesAid Software

"steven" wrote in message
...
Hello

unlike most of the post I'd lke the code to a macro that does not delete
rows. To be more specific I'd like my macro to check the values of column
E
of the list, for 3 criteria, and if any of the three exist then to KEEP
these
rows and delete all the others.


I guess it would have to be a macro similar to the one found at
http://www.rondebruin.nl/delete.htm only instead of deleting the rows that
meet the criteria, keep these rows and delete the rest.

any help apreciated

Steven.





All times are GMT +1. The time now is 05:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com