ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how to eleminate a row that contains 2 cells with zero value (https://www.excelbanter.com/excel-discussion-misc-queries/149556-how-eleminate-row-contains-2-cells-zero-value.html)

aafrinasghar

how to eleminate a row that contains 2 cells with zero value
 
how to eleminate a row that contains 2 cells with zero value

Bob Phillips

how to eleminate a row that contains 2 cells with zero value
 
Untested

Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim iLastRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow To 1 Step -1
If Application.CountIf(.Rows(i), 0) = 2 Then
.Rows(i).Delete
End If
Next i

End With

End Sub

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"aafrinasghar" wrote in message
...
how to eleminate a row that contains 2 cells with zero value





All times are GMT +1. The time now is 10:18 AM.

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