danieldang
New Member
- Joined
- Apr 27, 2023
- Messages
- 3
- Office Version
- 2021
- Platform
- Windows
Dear all,
I am very new to Excel VBA, I am creating the table for a purpose and will use the table for about 9 months each year.
As you can see in the attached photo, I have a list of teams and players. The players is listed in the range B6:G20.
Some of the names have number followed which indicates the duplicate and the order of cell data update.
As of now, all the information in the table is entered manually by me including duplications.
Now I want to write a VBA code to find the duplicate executing right after I update I cell. If the duplicate is found, insert incremental number after the name and most important, update the duplicate cell if previous duplicate is removed.
For example, I enter "Haaland" in cell D18, then I enter "Haaland" again in cell F18. After I finish entering, the VBA code will run automatically and find duplication in cell D18 and cell F18. Because the information in cell D18 is updated first, then the information in cell F18 will be changed into "Haaland 2".
Again, I enter "Haaland" again in cell E20. After I finish entering, the VBA code will run automatically and find duplication in cell D18, cell F18 and cell E20. Because the information in cell D18 is updated first, the information in cell F18 is updated second, then the information in cell E20 will be changed into "Haaland 3".
Now if I remove any "Haaland" in cell D18 or F18, the incremental number of E20 should be decrease.
I don't even know if VBA code can do this or not so please help me.
Thank you so much.
If anything is unclear, feel free to leave a comment and I will explain in detailed.
I am very new to Excel VBA, I am creating the table for a purpose and will use the table for about 9 months each year.
As you can see in the attached photo, I have a list of teams and players. The players is listed in the range B6:G20.
Some of the names have number followed which indicates the duplicate and the order of cell data update.
As of now, all the information in the table is entered manually by me including duplications.
Now I want to write a VBA code to find the duplicate executing right after I update I cell. If the duplicate is found, insert incremental number after the name and most important, update the duplicate cell if previous duplicate is removed.
For example, I enter "Haaland" in cell D18, then I enter "Haaland" again in cell F18. After I finish entering, the VBA code will run automatically and find duplication in cell D18 and cell F18. Because the information in cell D18 is updated first, then the information in cell F18 will be changed into "Haaland 2".
Again, I enter "Haaland" again in cell E20. After I finish entering, the VBA code will run automatically and find duplication in cell D18, cell F18 and cell E20. Because the information in cell D18 is updated first, the information in cell F18 is updated second, then the information in cell E20 will be changed into "Haaland 3".
Now if I remove any "Haaland" in cell D18 or F18, the incremental number of E20 should be decrease.
I don't even know if VBA code can do this or not so please help me.
Thank you so much.
If anything is unclear, feel free to leave a comment and I will explain in detailed.