View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Deleting rows that dont...

Hi Dominique,

I have amended the sub to keep the first row and taken the opportunity
properly to qualify the intersect range:

Sub DelRows3a()
Dim uRange As Range
Dim delRange As Range
Dim cell As Range
Dim rCell As Range
Dim blKeep As Boolean

With Worksheets("CLSEXCEL")
Set uRange = .UsedRange
Set delRange = uRange.Cells _
(uRange.Rows.Count + 1, 1).EntireRow
For Each rCell In Intersect(uRange, .Columns("D:D"))
blKeep = False
For Each cell In Worksheets("DocList").Range("Forms")
If rCell.Value = cell.Value Or rCell.Row = 1 Then
blKeep = True
Exit For
End If
Next cell
If Not blKeep Then
Set delRange = Union(delRange, rCell.EntireRow)
End If
Next rCell
End With
delRange.Delete
End Sub

---
Regards,
Norman



"Dominique Feteau" wrote in message
...
this works great. works perfectly. is there anyway that we can keep the
first row? its no biggie, but that would be perfect.

thanx