View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Murray Murray is offline
external usenet poster
 
Posts: 23
Default 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