Delete row based on cell value present in same row and different colums

reachmanoj27

New Member
Joined
Aug 31, 2016
Messages
6
Hi everyone,

i need delete the row based on cell value which is in multiple columns, criteria is delete the row if the value is Zero in all the columns from A to L.

thank you
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Code:
Sub deleteZero()
Dim lr As Long, i As Long, num As Boolean
With ActiveSheet
    lr = .Cells.Find("*", , xlFormulas, xlPart, xlByRows, xlPrevious).Row
    For i = lr To 2 Step -1
        For j = 1 To 12
            num = True
            If Not IsNumeric(.Cells(i, j).Value) Then
                num = False
                Exit For
            End If
        Next
        If num = True And Application.Sum(.Cells(i, 1).Resize(1, 12)) = 0 Then Rows(i).Delete
    Next
End With
End Sub
 
Upvote 0
Hi reahman0j27,
I am no expert but have put together some VBA using help from many others. I usually manage to adapt what I see. so here is something I have adapted that may help, This will clear a row if there is a 0 in any of the columns A through L unless there is another number. EG if there is a 0 in cell A5 and nothing else in any of row 5 as far across as L then the row will be deleted as the total is 0 if there is a 0 in A6 but B6 contains a 1 then that row will not get deleted. However if all rows are blank then the row also will not be deleted.
Code:
Sub Clear_Rows()
'Sub ClearRows()
 Dim cell As Range
 For Each cell In Range("A:L")
If UCase(cell.Value) = 0 Then
cell.EntireRow.Delete
 End If
 Next
 End Sub
I hope this helps
Mick.
 
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,085
Members
452,378
Latest member
Hoodzy01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top