![]() |
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........ |
matching items on 2 sheets
Sorry whe I wrote that code for you I was obviously a little off. The A's and
B's were apparently more that I could fathom... Give me a few minutes to think about this... "JT" wrote: 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........ |
matching items on 2 sheets
Dim rngToFind As Range
Dim rngFound As Range Set rngToFind = Sheets("1").Range("A65535").End(xlup) do while rngToFind.row 1 Set rngFound = Sheets("2").Columns(1).Find(rngToFind.Value) if not rngFound is nothing then rngToFind.EntireRow.Delete set rngtofind = rngtofind.offset(-1,0) loop "JT" wrote: 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) Any help would be greatly appreciated. Thanks........ |
All times are GMT +1. The time now is 07:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com