Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default matching items on 2 sheets

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default matching items on 2 sheets

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Matching like items Donna[_2_] Excel Worksheet Functions 2 June 2nd 10 10:03 PM
Formula for non matching items henriques Excel Worksheet Functions 3 April 13th 09 05:53 PM
Matching/Counting items beefneath Excel Discussion (Misc queries) 0 February 23rd 09 12:46 PM
Matching Items from 1 list to 2 others jack Excel Discussion (Misc queries) 3 February 19th 07 06:02 PM
Matching Items Smish Excel Worksheet Functions 3 January 29th 06 04:05 PM


All times are GMT +1. The time now is 06:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"