VBA search table, delete row

Enzo_Matrix

Board Regular
Joined
Jan 9, 2018
Messages
113
morning,
I have a table and I want to delete entire rows, if there is any value in them. I've come this far, by modifying previous code I have, but need some help changing the "void" to search for any number in that field.

Code:
Sub DeleteShip()
    
    Dim c As Range
    Dim SrchRng


    Set SrchRng = ActiveSheet.Range("I1", ActiveSheet.Range("I65536").End(xlUp))
    Do
        Set c = SrchRng.Find("Void", LookIn:=xlValues)
        If Not c Is Nothing Then c.EntireRow.Delete
    Loop While Not c Is Nothing
End Sub
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Try this:
Code:
Sub DeleteShip()
On Error Resume Next
Range("I1", Cells(Rows.count, "I").End(xlUp)).SpecialCells(xlConstants, xlNumbers).EntireRow.Delete
On Error GoTo 0
End Sub
 
Upvote 0
You're welcome, glad to help, & thanks for the feedback.:)
 
Upvote 0

Forum statistics

Threads
1,214,605
Messages
6,120,476
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