ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete a filtered set (https://www.excelbanter.com/excel-programming/419637-delete-filtered-set.html)

cmac

Delete a filtered set
 
Hello,

As a part of a macro I would like to turn auto filters on and then find rows
of data that contain a zero in the 4th field. I would then like to delete
the rows contained in the results - however, the range may be different each
time the macro is run. is there a way to delete the results in general - can
you help?

Michael

Delete a filtered set
 
Try this in Column A:

Sub FilterZeros()
Columns("A:A").AutoFilter
Range("A:A").AutoFilter Field:=1, Criteria1:="=0", Operator:=xlAnd
Range("A:A").SpecialCells(xlCellTypeVisible).Entir eRow.Delete Shift:=xlUp

End SUb

--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"cmac" wrote:

Hello,

As a part of a macro I would like to turn auto filters on and then find rows
of data that contain a zero in the 4th field. I would then like to delete
the rows contained in the results - however, the range may be different each
time the macro is run. is there a way to delete the results in general - can
you help?



All times are GMT +1. The time now is 10:31 AM.

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