PDA

View Full Version : Solved: Delete Rows That Total 0



dgilbert
02-01-2010, 12:34 PM
I have a need to automatically delete rows where a total amount in column p = zero. This would apply to all rows in the spreadsheet starting with row 3 and continuing to the end of the spreadsheet. This spreadsheet may have as many 10,000 rows. I attached an example spreadsheet. Could you help me with the code to do this?

Thanks

mbarron
02-01-2010, 01:08 PM
Sub DelRowsPEq0()

'
Application.ScreenUpdating = False
Range("P4").AutoFilter
With Range("p4").CurrentRegion
.AutoFilter Field:=14, Criteria1:="0"
End With
Range("a4", Range("a4").SpecialCells(xlLastCell)).SpecialCells(xlCellTypeVisible).EntireRow.Delet e
Range("A4").AutoFilter
Application.ScreenUpdating = True
End Sub

dgilbert
02-01-2010, 01:16 PM
This works great! Thanks for the quick reply and great help.