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 Not empty but zero

Try:


Sub RealZero()
Dim iLastRow As Long
Dim i As Long
Dim rng As Range

iLastRow = 65536
For i = 1 To iLastRow
If Cells(i, 17).Value = 0 And Not IsEmpty(Cells(i, 17)) Then
If rng Is Nothing Then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
End If
Next i

If Not rng Is Nothing Then
rng.Delete

End If



End Sub

--
Gary's Student


"Metrazal" wrote:


I need the code to delete a record/row if cell Q (of that record/row) is
0. Not empty but 0

What would be the best way to achieve this?

Thanks,

Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile: http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=515285