Mr.
Please can somebody help.
I have an excel sheet that conatins the following:
A, B, C, D, E, F
Seq, Ref. , Source, Debit, Credit, Balance
8, 111, 2, 5, 0, 123467
2, 120, 1, 10, 0, 123466
2, 120, 2, 10, 0, 123466
4, 6666, 1, 50, 0, 123496
9, 6666, 2, 50, 0, 123517
7, 8787, 2, 50, 0, 123462
5, 485, 1, 50, 0, 123546
10, 485, 2, 50, 0, 123567
11, 22, 2, 50, 0, 123617
12, 125544, 2, 12354, 0, 135971
7, 777, 1, 0, 7, 123519
4, 777, 2, 0, 7, 123439
5, 888, 2, 0, 7, 123432
3, 505, 1, 0, 20, 123446
6, 505, 2, 0, 20, 123412
3, 951, 2, 0, 20, 123446
6, 546546, 1, 0, 20, 123526
8, 1113, 1, 0, 55684, 67835
13, 1113, 2, 0, 55684, 80287
I want to write VBA code that would enable me to read th first row and match it against the remaining rows in the range to find a match. A match for the first row is a row that has (5) in Debit, (111) in Ref. No. but a (1) in Source. In the above example there is no match to first row, so it stays. When we move on to the second row, there is match because row three has the same debit and ref. no. and a 2 in source. Because there is a match, the program should delete both row 2 and row 3. It should then move on to the subsequent row. In the end the result should be as follows:
8, 111, 2, 5, 0, 123467
7, 8787, 2, 50, 0, 123462
11, 22, 2, 50, 0, 123617
12, 125544, 2, 12354, 0, 135971
5, 888, 2, 0, 7, 123432
3, 951, 2, 0, 20, 123446
6, 546546, 1, 0, 20, 123526
The above are rows that occure once only with no match.
Many thanks
Last edited by Shawki Hagagi; June 15th, 2010 at 08:57 AM..
|