Hi All,
I have an Excel file name "Security macro.xlsm". There are 11 columns on sheet1 of this excel file.
User enters a new record manually, in column A, C, D, E, F, G, H, I, J and K.
Column B, values in this column "Security ID number" are already populated.
I am looking for a VBA solution to achieve that when user enters a new record, run that VBA code and if the new values in column E, H, I, J and K match existing data in the same columns, it will automatically add a new line under the existing record, cut values in column A, C, D, E, F, G, H, I, J and K and paste them in the new line and then sum the "Quantity" and show the sum on additional new line.
I have provided examples of both the original data and how the data should appear after running VBA code.
Could someone kindly help?
I have an Excel file name "Security macro.xlsm". There are 11 columns on sheet1 of this excel file.
User enters a new record manually, in column A, C, D, E, F, G, H, I, J and K.
Column B, values in this column "Security ID number" are already populated.
I am looking for a VBA solution to achieve that when user enters a new record, run that VBA code and if the new values in column E, H, I, J and K match existing data in the same columns, it will automatically add a new line under the existing record, cut values in column A, C, D, E, F, G, H, I, J and K and paste them in the new line and then sum the "Quantity" and show the sum on additional new line.
I have provided examples of both the original data and how the data should appear after running VBA code.
Could someone kindly help?
Example of ORIGINAL DATA | ||||||||||
System ref | Security ID Number | CLIENT/CPTY | Quantity | CCY | Deal date | Sett. Date | Maturity Date | Rate | Security Type | Instrument |
12345678 | GB6341659900 | Client 1 | 100,000,000.00 | GBP | 28-Apr-23 | 03-May-23 | 05-Jul-23 | 4.47 | Non-Discounted | A |
12345679 | GB6341659901 | Client 2 | 100,000,000.00 | EUR | 28-Apr-23 | 03-May-23 | 10-Jul-23 | 3.21 | Discounted | A |
12345680 | GB6341659902 | Client 1 | 20,000,000.00 | EUR | 28-Apr-23 | 03-May-23 | 01-Jun-23 | 3.18 | Discounted | B |
12345681 | GB6341659903 | Client 4 | 50,000,000.00 | EUR | 28-Apr-23 | 03-May-23 | 03-Aug-23 | 3.415 | Discounted | B |
12345682 | GB6341659904 | Client 5 | 130,000,000.00 | GBP | 28-Apr-23 | 03-May-23 | 03-Aug-23 | 4.705 | Discounted | B |
12345683 | GB6341659905 | Client 6 | 50,000,000.00 | EUR | 02-May-23 | 04-May-23 | 02-Aug-23 | 3.405 | Discounted | B |
12345684 | GB6341659906 | Client 7 | 30,000,000.00 | GBP | 02-May-23 | 04-May-23 | 05-Jul-23 | 4.47 | Non-Discounted | A |
12345685 | GB6341659907 | Client 8 | 73,610,000.00 | USD | 02-May-23 | 03-May-23 | 15-Jun-23 | 5.16 | Discounted | A |
12345686 | GB6341659908 | Client 9 | 100,000,000.00 | EUR | 02-May-23 | 03-May-23 | 05-Jun-23 | 3.205 | Discounted | B |
12345687 | GB6341659909 | Client 10 | 65,000,000.00 | EUR | 02-May-23 | 04-May-23 | 05-Jun-23 | 3.225 | Discounted | B |
12345688 | GB6341659910 | Client 11 | 50,000,000.00 | EUR | 02-May-23 | 04-May-23 | 04-Aug-23 | 3.425 | Discounted | B |
Example of data below, should appearing after running VBA code. | ||||||||||
System ref | Security ID Number | CLIENT/CPTY | Quantity | CCY | Deal date | Sett. Date | Maturity Date | Rate | Security Type | Instrument |
12345678 | GB6341659900 | Client 1 | 100,000,000.00 | GBP | 28-Apr-23 | 03-May-23 | 05-Jul-23 | 4.47 | Non-Discounted | A |
12345684 | Client 7 | 30,000,000.00 | GBP | 02-May-23 | 04-May-23 | 05-Jul-23 | 4.47 | Non-Discounted | A | |
130,000,000.00 | ||||||||||
12345679 | GB6341659901 | Client 2 | 100,000,000.00 | EUR | 28-Apr-23 | 03-May-23 | 10-Jul-23 | 3.21 | Discounted | A |
12345680 | GB6341659902 | Client 1 | 20,000,000.00 | EUR | 28-Apr-23 | 03-May-23 | 01-Jun-23 | 3.18 | Discounted | B |
12345681 | GB6341659903 | Client 4 | 50,000,000.00 | EUR | 28-Apr-23 | 03-May-23 | 03-Aug-23 | 3.415 | Discounted | B |
12345682 | GB6341659904 | Client 5 | 130,000,000.00 | GBP | 28-Apr-23 | 03-May-23 | 03-Aug-23 | 4.705 | Discounted | B |
12345683 | GB6341659905 | Client 6 | 50,000,000.00 | EUR | 02-May-23 | 04-May-23 | 02-Aug-23 | 3.405 | Discounted | B |
12345684 | GB6341659906 | Client 7 | 30,000,000.00 | GBP | 02-May-23 | 04-May-23 | 05-Jul-23 | 4.47 | Non-Discounted | A |
12345685 | GB6341659907 | Client 8 | 73,610,000.00 | USD | 02-May-23 | 03-May-23 | 15-Jun-23 | 5.16 | Discounted | A |
12345686 | GB6341659908 | Client 9 | 100,000,000.00 | EUR | 02-May-23 | 03-May-23 | 05-Jun-23 | 3.205 | Discounted | B |
12345687 | GB6341659909 | Client 10 | 65,000,000.00 | EUR | 02-May-23 | 04-May-23 | 05-Jun-23 | 3.225 | Discounted | B |
12345688 | GB6341659910 | Client 11 | 50,000,000.00 | EUR | 02-May-23 | 04-May-23 | 04-Aug-23 | 3.425 | Discounted | B |