View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Clear contents if x is not in the row

Sub Tester9()
Dim rng As Range
Dim fAddr As String
Columns(1).Insert
Set rng = Cells.Find("All", AFter:=Range("IV65535"), _
LookIn:=xlValues, LookAt:=xlPart)
If Not rng Is Nothing Then
fAddr = rng.Address
Do
Cells(rng.Row, 1).Value = "X"
Set rng = Cells.FindNext(rng)
Loop While rng.Address < fAddr
Else
ActiveSheet.UsedRange.Rows.Delete
Columns(1).Delete
Exit Sub
End If
Set rng = Columns(1).SpecialCells(xlBlanks)
rng.EntireRow.Delete
Columns(1).Delete
End Sub

--
Regards,
Tom Ogilvy

"Mighvik" wrote in message
...
I need to clear the contents in all rows except rows with
the word "ALL" in it.

Can someone help?
Thanks