Deletion of completely empty rows or with zero value

vidplaylist

Board Regular
Joined
Aug 3, 2011
Messages
78
Deletion of completely empty rows or rows with zero value.

For example Column D has value in D5 and D7 and Column E has value in E2 and E9. I want to keep these rows and want to delete completely empty rows or with zero value.

Thanks in advance,
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Try

Code:
Sub DelDE()
Dim LR As Long
LR = Range("D" & Rows.Count).End(xlUp).Row
For i = LR To 1 Step -1
    With Range("D" & i)
        If .Value = "" Or .Value = 0 Or .Offset(, 1).Value = "" Or .Offset(, 1).Value = 0 Then .EntireRow.Delete
    End With
Next i
End Sub
 
Upvote 0
It's deleting everything in range other than Cell E2. I want to keep all rows containing cell D5,D7,E2 and E9
 
Upvote 0
Try

Code:
Sub DelDE()
Dim LR As Long, i As Long
LR = Columns("D:E").Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
For i = LR To 1 Step -1
    With Range("D" & i)
        If (.Value = "" Or .Value = 0) And (.Offset(, 1).Value = "" Or .Offset(, 1).Value = 0) Then .EntireRow.Delete
    End With
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,537
Messages
6,179,405
Members
452,911
Latest member
a_barila

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