Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am attempting to sort data containing specific characters and delete
all rows but the ones that meet the critera. Such as search for "LW" and get all LWLI, LWOS, LWSC, etc. I have a macro working currently that will select one of the above and delete all the rest...but I need to make this a bit more robust to keep all LW's Dim rng As Range, cell As Range, del As Range Set rng = Intersect(Range("A:A"), ActiveSheet.UsedRange) For Each cell In rng If (cell.Value) < "LWLI" Then If del Is Nothing Then Set del = cell Else: Set del = Union(del, cell) End If End If Next cell On Error Resume Next del.EntireRow.Delete ' If I need to go about this from the back side and manually list all vs a wild card type entry than I will, but I still need some help and making a multiple selection criteria. When I try this now...It is seeing the search as exclusive and deleting all data. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need macro to delete all text cells in an Excel range | Excel Worksheet Functions | |||
How do I pause a macro to select specific cells | Excel Worksheet Functions | |||
Delete specific cells contents in a row with some locked cells in the same row | Excel Programming | |||
Excel Macro Query - Search for specific text in cells of a column | Excel Programming | |||
Macro to delete rows with text cells | Excel Programming |