Delete Row if column E range is empty but has formula inside

zone709

Well-known Member
Joined
Mar 1, 2016
Messages
2,079
Office Version
  1. 365
Platform
  1. Windows
VBA Code:
Sub Delete2()
Range("E3:E168").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub

This works fine if column E is empty, but if there is a formula inside it and even though its blank. It will not delete row. So i think its needs something added if the cells are blank even if a formula is inside it. Still delete the row.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I don't know what your formulas look like, but try it.
VBA Code:
Sub Delete2()
    Range("E3:168").SpecialCells(xlCellTypeFormulas, xlTextValues).EntireRow.Delete
End Sub
 
Upvote 0
Hi doesn't work I get message run time 1004 then class not registered
 
Upvote 0
One way:
VBA Code:
Sub Delete2()

    Dim r as Long

    Application.ScreenUpdating = False

    For r = 168 to 3 Step -1
        If Cells(r, "E").Value = "" Then Rows(r).Delete
    Next r

    Application.ScreenUpdating =True

End Sub
 
Upvote 0
Solution
Missing Letter "E".My mistake.
VBA Code:
Sub Delete2()
    Range("E3:E168").SpecialCells(xlCellTypeFormulas, xlTextValues).EntireRow.Delete
End Sub
 
Upvote 0
its breaks Joe. I think its breaking from the tp
 
Upvote 0
Hi maras it kind of works now but deletes all the rows even when there is something in it. Column E is pulling in from another sheet so it has formula's but some cells below it also pulls in formula's but cell is empty. Those are the only cells i am trying to delete with row.
 
Upvote 0
its breaks Joe. I think its breaking from the tp
Yes, I had a typo in there, but I fixed it within a minute or two.
You must have copied it before I fixed. Change that "tp" to "to" and it should work.
 
Upvote 0
One way:
VBA Code:
Sub Delete2()

    Dim r as Long

    Application.ScreenUpdating = False

    For r = 168 to 3 Step -1
        If Cells(r, "E").Value = "" Then Rows(r).Delete
    Next r

    Application.ScreenUpdating =True

End Sub
works thanks
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,488
Members
448,967
Latest member
visheshkotha

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