ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Deletion of rows where a value is satisfied (https://www.excelbanter.com/excel-worksheet-functions/14362-deletion-rows-where-value-satisfied.html)

Larry Wallis

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.

Jason Morin

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.
.



All times are GMT +1. The time now is 04:52 PM.

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