View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
skatonni via OfficeKB.com skatonni via OfficeKB.com is offline
external usenet poster
 
Posts: 23
Default How to Delete row with criteria ?

Starting with code I found here
http://www.angelfire.com/biz7/julian...ans_macros.htm
First select the cells in the column

Sub DelRowIfCriteria()
Dim rng As Integer
Dim i As Integer

Dim cellCriteria As Integer

cellCriteria = InputBox(prompt:="Enter criteria.")

rng = Selection.Rows.Count
ActiveCell.Offset(0, 0).Select
Application.ScreenUpdating = False
For i = 1 To rng
If ActiveCell.Value = cellCriteria Then
Selection.EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Select
End If
Next i
Application.ScreenUpdating = True
End Sub

vumian wrote:
Hi everyone.

I have a col that contains many other value such as:
A1 contain 0
A2 - 544
A3 -0
A4 - 100
A5 -0
A6 -53
A7 -0


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200607/1