+ Reply to Thread
Results 1 to 2 of 2

Deletion of rows where a value is satisfied

  1. #1
    Larry Wallis
    Guest

    Deletion of rows where a value is satisfied

    I have a spreadsheet with 3 colums. Columns are headed Part Number,
    Description and Qty.

    What I would like to do is delete all rows where the qty value is zero.

    I can't do this using auto filter as I have some small sub headings within
    the list and want them to stay visible.

    Any ideas please?

    Many thanks.

    Larry.

  2. #2
    Jason Morin
    Guest

    Re: Deletion of rows where a value is satisfied

    One way. Press ALT+F11, go to Insert > Module, and paste
    in the code below. Press ALT+Q and run the macro from
    Tools > Macro. The code below evaluates col. A:

    Sub DeleteRow()
    'Adapted from Microsoft code found at
    'msdn.microsoft.com
    Dim sFind As Long
    Dim Rng As Range
    Dim sFindRow As Long
    sFind = 0
    Set Rng = Range("A:A").Find(What:=sFind, lookat:=xlWhole)
    While Not Rng Is Nothing
    sFindRow = Rng.Row
    Rng.EntireRow.Delete
    Set Rng = Range("A" & sFindRow - 1 & ":A" & _
    Rows.Count) _
    .Find(What:=sFind, lookat:=xlWhole)
    Wend
    End Sub

    ---
    Note that this works on 0 values, not formulas returning
    the value 0.

    HTH
    Jason
    Atlanta, GA

    >-----Original Message-----
    >I have a spreadsheet with 3 colums. Columns are headed

    Part Number,
    >Description and Qty.
    >
    >What I would like to do is delete all rows where the qty

    value is zero.
    >
    >I can't do this using auto filter as I have some small

    sub headings within
    >the list and want them to stay visible.
    >
    >Any ideas please?
    >
    >Many thanks.
    >
    >Larry.
    >.
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1