View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JT[_2_] JT[_2_] is offline
external usenet poster
 
Posts: 96
Default matching items on 2 sheets

I'm having some problems with the code below. "Range" is
a range name for the items in column A on sheet 2.

I want to look in column A on sheet 1 and if there is a
match in the range (Column A - sheet 2), then I want to
delete the row on Sheet 1 where the match occurs


Sheets("1").Activate

Dim rngToSearch
Dim rngToFind As Range
Dim rngFound As Range

Set rngToSearch = Sheets("2").Range("Range")

For Each rngToFind In rngToSearch

Set rngFound = Sheets("1").Cells.Find(rngToFind.Value)

Do While Not rngFound Is Nothing

rngFound.EntireRow.Delete
Set rngFound = Sheets("1").Cells.Find.
(rngToFind.Value)

Loop

Next rngToFind

Any help would be greatly appreciated. Thanks........