Delete rows based on cell value

Jenawade

Board Regular
Joined
Apr 8, 2002
Messages
231
I have a database dump over 230,000 lines long that looks like this:

Excel Workbook
ABCDEF
1LevelParent ItemReferenceDescriptionQuantity PerUM
419bmwurp.p 2+**13.8.14 Where#NAME?*
420Page: 9**TRW Automotive VMS TRAIN*
421******
422LevelParent ItemReferenceDescriptionQuantity PerUM
423-------------------------------------------------------------------------------
424Component55902*SPRING*EA
425179777*SPRING INACTIVE8EA
426***C8TZ2068C**
427******
428Component55919*WASHER INACTIVE*EA
42919574601*WASHER KIT INACTIVE10EA
430******
431Component55926*ADJ LEVER POST*EA
432180425*ADJ LEVER POST INACTIVE1EA
433******
434Component55928*LINK COLLAR*EA
435180419*COLLAR ADJ LINK INACTIVE4EA
436******
437Component55971*TORSION SPRING*EA
438***C8TZ 2A1080 C**
439180426*SPRING KIT INACTIVE4EA
440***C8TZ 2A180 C**
441******
Where Used


I need to delete the rows similar to 419-423. Every group of these rows says the same thing in Column D, so I need to delete every row with one of these in column D

13.8.14 Where
TRW Automotiv
Description
------------------------

Can someone please help with some code? I give up trying on my own, I've wasted too much time.

Thanks so much!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
try this

Code:
Sub cleanup()
LR = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
'filter data
    Cells.AutoFilter
    Cells.AutoFilter Field:=4, Criteria1:="13.8.14 Where"
        Range("D2:D" & LR).EntireRow.Delete
    Cells.AutoFilter Field:=4, Criteria1:="TRW Automotiv"
        Range("D2:D" & LR).EntireRow.Delete
    Cells.AutoFilter Field:=4, Criteria1:="Description"
        Range("D2:D" & LR).EntireRow.Delete
    Cells.AutoFilter Field:=4, Criteria1:="------------------------"
        Range("D2:D" & LR).EntireRow.Delete
    Cells.AutoFilter
MsgBox "Done'"
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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