Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Find and delete all other rows
Hi all
I am trying to get a Macro to find the word or part of the word in a cell. All cells that do not have that word should be deleted. If I use the follwoing it does not work Set c = .Find("test", LookIn:=xlValues) If c Is Nothing Then c.EntireRow.Delete Else firstAddress = c.Address Do c.Interior.ColorIndex = 6 Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address < firstAddress End If |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Find and delete all other rows
If the range that you're looking through is a single column, you could apply
Data|Filter|autofilter to that column. Then filter using Custom|Does not contain|test and delete the visible rows And then remove the filter. Murray wrote: Hi all I am trying to get a Macro to find the word or part of the word in a cell. All cells that do not have that word should be deleted. If I use the follwoing it does not work Set c = .Find("test", LookIn:=xlValues) If c Is Nothing Then c.EntireRow.Delete Else firstAddress = c.Address Do c.Interior.ColorIndex = 6 Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address < firstAddress End If -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
"Last Cell" to find last row, but can't delete blank rows | Excel Discussion (Misc queries) | |||
Find & delete rows with ID's from another sheet. | Excel Discussion (Misc queries) | |||
how do i find and delete all empty rows in an excel worksheet | Excel Worksheet Functions | |||
Macro to find and delete rows! | Excel Discussion (Misc queries) | |||
How do I find duplicate rows in a list in Excel, and not delete it | Excel Discussion (Misc queries) |