Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert rows based on specific value | Excel Worksheet Functions | |||
flexible paste rows function that inserts the right number of rows | Excel Discussion (Misc queries) | |||
Row selections by row # OR by even/odd rows in another spreadsheet | Excel Discussion (Misc queries) | |||
Adding Rows to Master Sheet | New Users to Excel | |||
Copying Rows when hiding other rows | Excel Worksheet Functions |