View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Excelenator[_45_] Excelenator[_45_] is offline
external usenet poster
 
Posts: 1
Default Delete Row when value inside cell is less than 0


bm4466 Wrote:
Thanks a lot...do you know how to do it when the value is less than or
equal to 0?



The only way I know is to loop through each value and test it like
this


Code:
--------------------
Sub DelRowVal()
'To be run after you have removed all blanks and errors from column A
Dim c As Range
Dim r As String

r = ""
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select

For Each c In Selection
If c.Value <= 0 Then
r = r + c.Address + ","
End If
Next c

If r < "" Then
r = Mid(r, 1, Len(r) - 1)
Range(r).EntireRow.Select
Selection.EntireRow.Delete
Range("A1").Select
End If
End Sub
--------------------


--
Excelenator


------------------------------------------------------------------------
Excelenator's Profile: http://www.excelforum.com/member.php...o&userid=36768
View this thread: http://www.excelforum.com/showthread...hreadid=568341