Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My macro pulls data into Sheet (B). Sheet (A) contains up-
to-date balances for some of the items on Sheet (B). Column A on each sheet contains a reference number. I want to look at each item on Sheet (A) and see if there is a match on Sheet (B). If there isn't a match, I want to delete the item on Sheet (A). I could start at the top of Sheet (A) and look through all of the reference numbers on Sheet (B) until I either get a match or get to the bottom of the list. If I get to the bottom of Sheet (B), I would delete the item on Sheet (A). There must be a better way than to cycle though Sheet (B) for each item on Sheet (A). Any suggestions or ideas would be greatly appreciated. As always, thanks for the help. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I dont personally agree with deleting data but if that is what you want here
goes... sub RemoveRows dim rngToSearch dim rngToFind as range dim rngFound as range set rngToSearch = sheets("SheetB").range("A1:A30") 'no idea how you know what to search for each rngTofind in rngToSearch set rngFound = sheets("SheetA").cells.find(rngTofind.value) do while not rngFound is nothing rngfound.entirerow.delete set rngFound = sheets("SheetA").cells.find(rngTofind.value) loop next rngToFind end sub or something like that... "JT" wrote: My macro pulls data into Sheet (B). Sheet (A) contains up- to-date balances for some of the items on Sheet (B). Column A on each sheet contains a reference number. I want to look at each item on Sheet (A) and see if there is a match on Sheet (B). If there isn't a match, I want to delete the item on Sheet (A). I could start at the top of Sheet (A) and look through all of the reference numbers on Sheet (B) until I either get a match or get to the bottom of the list. If I get to the bottom of Sheet (B), I would delete the item on Sheet (A). There must be a better way than to cycle though Sheet (B) for each item on Sheet (A). Any suggestions or ideas would be greatly appreciated. As always, thanks for the help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Matching like items | Excel Worksheet Functions | |||
Formula for non matching items | Excel Worksheet Functions | |||
Matching/Counting items | Excel Discussion (Misc queries) | |||
Matching Items from 1 list to 2 others | Excel Discussion (Misc queries) | |||
Matching Items | Excel Worksheet Functions |