View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Luca Villa Luca Villa is offline
external usenet poster
 
Posts: 13
Default Excel macro that deletes all rows which doesn't contain the ch

I used this short solution suggested to me in another forum:

Dim r As Range
Dim DelRs As Range

Set r = Range("E1")
Do Until r.Value = ""
If InStr(r.Value, "|") = 0 Then
If Not DelRs Is Nothing Then
Set DelRs = Union(DelRs, r)
Else
Set DelRs = r
End If
End If
Set r = r.Offset(1, 0)
Loop
DelRs.EntireRow.Delete



Thanks to all (Adriano and Norman) anyway for your contribution!