View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Conditions in a macro

Sub DeleteRows()
Dim iLastRow As Long
Dim I As Long
iLastRow = Cells(Rows.Count, "C").End(xlUp).Row
For I = iLastRow To 1 Step -1
If Cells(I, "C").Value <= 0 Then
Rows(I).Delete
End If
Next I
End Sub

Edit the "C" to suit.


Gord Dibben MS Excel MVP

On Tue, 3 Jun 2008 15:59:02 -0700, Damon
wrote:

Hey there,

I am trying to have my marco delete all rows with a value equal to or less
then 0 (in a particular field). Any help would be great.

Thanks,