Thread: vba filter
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Otto Moehrbach[_6_] Otto Moehrbach[_6_] is offline
external usenet poster
 
Posts: 201
Default vba filter

Gabriel
I'll assume your list is on Sheet "Two" and your data is on sheet "One".
Sub DeleteRows()
Dim TheRange As Range
Dim c As Long
With Sheets("One")
Set TheRange = .Range("A1", .Range("A" & Rows.Count).End(xlUp))
For c = TheRange.Count To 1 Step -1
If Range("TheList").Find(What:=TheRange(c), _
LookAt:=xlWhole) Is Nothing Then _
TheRange(c).EntireRow.Delete
Next
End With
End Sub

HTH Otto
"Gabriel" wrote in message
om...
Hi,

I have a table in excel that looks like this:

Book1 Author1 Categ1
Book2 Author2 Categ2
Book3 Author3 Categ3
Book4 Author4 Categ4

I also have a list : Book1, Book2

I want to write a vba code that deletes the entire lines of those
items in my table that are not apperearing on my list. Can anyone help
me?

Thank you
Gabriel