View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default if a cell equal to zero how can it delete entire row

For only a single cell, say cell Z100:


Sub demo()
If Range("Z100").Value = 0 Then
Range("Z100").EntireRow.Delete
End If
End Sub


For a range of cells, say all the cells in column Z

Sub demoi()
n = Cells(Rows.Count, "Z").End(xlUp).Row
For i = n To 1 Step -1
If Cells(i, "Z").Value = 0 Then
Cells(i, "Z").EntireRow.Delete
End If
Next
End Sub

--
Gary''s Student - gsnu200730


"yehia" wrote:

if a cell equal to zero how can we formulate it to delete the entire row