delete entire row if cell value in colum = 0

  • Thread starter Thread starter amanda
  • Start date Start date
A

amanda

Hello,

I'm trying to deleta a row if the cell value in column D is zero.

Thanks!
 
Something like this maybe...

Sub RemoveZeroRowsFromColumnD()
Dim X As Long
For X = ActiveSheet.Cells(Rows.Count, "D").End(xlUp).Row To 1 Step -1
If ActiveSheet.Cells(X, "D").Value = 0 Then
ActiveSheet.Cells(X, "D").EntireRow.Delete
End If
Next
End Sub

You can change the ActiveSheet reference to a specific sheet reference if
that is your need.

Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top