I have a spreadsheet where I need to create VBA code to delete the accounts that have a transaction that has been written off so in the spreadsheet it shows the listing twice once with a positive number and then with a negative number. These numbers are not always by each other, there may be several transactions between them. I have the code that is now marking them for delete but what it is doing is finding the first negative amount and then matching to the first positive amount that matches it. I need it to first check to see if the account number and date of transactions match and then if it does mark these two for deletion. Here is an example of the file.
AccountNumber ServiceDateTime Amount Mark for Deletion
12345617 1/1/2015 -521.56 Delete
12345617 1/1/2015 28.50
12345617 1/1/2015 521.56 Delete
12345617 1/1/2015 521.56
12345617 1/3/2015 18.57
12345617 1/5/2015 19.25
12345617 1/6/2015 1510.15
12345617 1/6/2015 -49.95 Delete
12345617 1/6/2015 49.95 Delete
12345617 1/10/2015 295.68
12345617 1/11/2015 19.98
12345617 1/12/2015 2508.25
Current Code:
Any help greatly appreciated.![]()
Please Login or Register to view this content.
Moderator Note: I have added code tags for you. Please read forum rules and comply in the future.
Bookmarks