ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Delete row with criteria ? (https://www.excelbanter.com/excel-programming/367696-how-delete-row-criteria.html)

vumian[_2_]

How to Delete row with criteria ?
 

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

skatonni via OfficeKB.com

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


All times are GMT +1. The time now is 01:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com