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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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,224,749
Messages
6,180,730
Members
452,995
Latest member
isldboy

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