Consulting

Results 1 to 3 of 3

Thread: Solved: Delete Rows That Total 0

  1. #1
    VBAX Regular
    Joined
    Jan 2010
    Location
    Des Moines, Iowa
    Posts
    13
    Location

    Solved: Delete Rows That Total 0

    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

  2. #2
    VBAX Mentor
    Joined
    Jun 2004
    Posts
    363
    Location
    [VBA]
    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).Entir eRow.Delete
    Range("A4").AutoFilter
    Application.ScreenUpdating = True
    End Sub[/VBA]

  3. #3
    VBAX Regular
    Joined
    Jan 2010
    Location
    Des Moines, Iowa
    Posts
    13
    Location
    This works great! Thanks for the quick reply and great help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •