• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Delete rows based on range of cells values


New Member

File is attached.

I am looking for a quick and easy way to delete all rows that can zero for every cell in column B through column G. For example, I would want to delete rows 9, 27, 31, and 35 easier. There is no financial data there and it would be nice to have shorter data sets over time. Please help! Thanks!



Active Member
Here is a VBA solution
Option Explicit

Sub delZero()
    Dim lr As Long, i As Long
    lr = Range("A" & Rows.Count).End(xlUp).Row
    If Range("B" & i) = 0 Then
        Range("B" & i).EntireRow.Delete
    End If
Next i
MsgBox "complete"
End Sub
Standard Module
How to install your new code
Copy the Excel VBA code
Select the workbook in which you want to store the Excel VBA code
Press Alt+F11 to open the Visual Basic Editor
Choose Insert > Module
Edit > Paste the macro into the module that appeared
Close the VBEditor
Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

To run the Excel VBA code:
Press Alt-F8 to open the macro list
Select a macro in the list
Click the Run button