Delete Rows with 0 Values

Ed_B

New Member
Joined
Mar 28, 2018
Messages
19
Office Version
  1. 2019
Platform
  1. Windows
Thank you in advance for your help.

I have a list of items some of which have 0 values. They are separated in groups and I would like to output the list keeping the groups, but deleting the rows with 0 values and adding a grand total:

INPUT
ItemUnit PriceQuantityTotal Price
Fruits
Peaches111
Mangos200
Berries326
Vegetables
Carrots200
Peas428
Potato326
OUTPUT
Fruits
Peaches111
Berries326
Vegetables
Peas428
Potato326
Total
Total Price21

<tbody>
</tbody>

<tbody>
</tbody>

Thanks again

Ed
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Assuming your Total row is in column D

Code:
Sub DeleteRow()


Dim RowToTest As Long


For RowToTest = Cells(Rows.Count, 4).End(xlUp).Row To 2 Step -1


With Cells(RowToTest, 4)
    If .Value <> 0 Then 
    Rows(RowToTest).EntireRow.Delete
End With


Next RowToTest


End Sub
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,432
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top