gingerbreadgrl
New Member
- Joined
- Aug 19, 2019
- Messages
- 48
Hi,
I am looking to automatically generate a unique identification number for each row in my spreadsheet. A few components of the number will be passed into the spreadsheet from another source. But, I need help creating two different parts of the ID. The first is a 3 digit number that will start at the beginning of the year and count up and it will restart at the beginning of the next year. The second is based on how many previous numbers they have, these numbers will be automatically populated into the spreadsheet, and will be separated by semicolons. The code must count how many numbers are in the cell and then add 1. I can't use a formula because for the data to auto-populate the spreadsheet the system must see a blank row. Therefore, I would like the two different numbers to appear in the cell via VBA once a cell has a value to it, particularly a cell in the name column. This is what the spreadsheet currently looks like:
[TABLE="width: 800"]
<tbody>[TR]
[TD]Complete ID[/TD]
[TD]Other Matter IDs[/TD]
[TD]2 digit year[/TD]
[TD]3 digit matter #[/TD]
[TD]C or S[/TD]
[TD]# of Matters[/TD]
[TD]Name[/TD]
[/TR]
[TR]
[TD]19001C-3[/TD]
[TD]1233456; 234567[/TD]
[TD]19[/TD]
[TD]001[/TD]
[TD]C[/TD]
[TD]3[/TD]
[TD]Jane Doe[/TD]
[/TR]
[TR]
[TD]19002S-2[/TD]
[TD]345678[/TD]
[TD]19[/TD]
[TD]002[/TD]
[TD]S[/TD]
[TD]2[/TD]
[TD]Sue Smith[/TD]
[/TR]
[TR]
[TD]19003C-1[/TD]
[TD][/TD]
[TD]19[/TD]
[TD]003[/TD]
[TD]C[/TD]
[TD]1[/TD]
[TD]Jack Johnson[/TD]
[/TR]
[TR]
[TD]20001S-2[/TD]
[TD]23456[/TD]
[TD]20[/TD]
[TD]001[/TD]
[TD]S[/TD]
[TD]2[/TD]
[TD]Sammy Sosa[/TD]
[/TR]
</tbody>[/TABLE]
The columns in red must auto-populate when a value appears in a name column cell. The columns in blue will flow through from a data source that creates a new row and fills in the information every time there is a new record. The 2 digit year will automatically change to 20 in 2020, that is when the 3 digit number must restart. The # of matters column must count the number of matter IDs in that column and add 1. You will see that if the other matter id's column is blank the # of matters column must take 0 and add 1. This creates the complete ID. If there is a way to put the cell contents together from the last 4 columns into the complete id column automatically that would be great too.
Any thoughts would be much appreciated!
Best,
Gingerbreadgrl
I am looking to automatically generate a unique identification number for each row in my spreadsheet. A few components of the number will be passed into the spreadsheet from another source. But, I need help creating two different parts of the ID. The first is a 3 digit number that will start at the beginning of the year and count up and it will restart at the beginning of the next year. The second is based on how many previous numbers they have, these numbers will be automatically populated into the spreadsheet, and will be separated by semicolons. The code must count how many numbers are in the cell and then add 1. I can't use a formula because for the data to auto-populate the spreadsheet the system must see a blank row. Therefore, I would like the two different numbers to appear in the cell via VBA once a cell has a value to it, particularly a cell in the name column. This is what the spreadsheet currently looks like:
[TABLE="width: 800"]
<tbody>[TR]
[TD]Complete ID[/TD]
[TD]Other Matter IDs[/TD]
[TD]2 digit year[/TD]
[TD]3 digit matter #[/TD]
[TD]C or S[/TD]
[TD]# of Matters[/TD]
[TD]Name[/TD]
[/TR]
[TR]
[TD]19001C-3[/TD]
[TD]1233456; 234567[/TD]
[TD]19[/TD]
[TD]001[/TD]
[TD]C[/TD]
[TD]3[/TD]
[TD]Jane Doe[/TD]
[/TR]
[TR]
[TD]19002S-2[/TD]
[TD]345678[/TD]
[TD]19[/TD]
[TD]002[/TD]
[TD]S[/TD]
[TD]2[/TD]
[TD]Sue Smith[/TD]
[/TR]
[TR]
[TD]19003C-1[/TD]
[TD][/TD]
[TD]19[/TD]
[TD]003[/TD]
[TD]C[/TD]
[TD]1[/TD]
[TD]Jack Johnson[/TD]
[/TR]
[TR]
[TD]20001S-2[/TD]
[TD]23456[/TD]
[TD]20[/TD]
[TD]001[/TD]
[TD]S[/TD]
[TD]2[/TD]
[TD]Sammy Sosa[/TD]
[/TR]
</tbody>[/TABLE]
The columns in red must auto-populate when a value appears in a name column cell. The columns in blue will flow through from a data source that creates a new row and fills in the information every time there is a new record. The 2 digit year will automatically change to 20 in 2020, that is when the 3 digit number must restart. The # of matters column must count the number of matter IDs in that column and add 1. You will see that if the other matter id's column is blank the # of matters column must take 0 and add 1. This creates the complete ID. If there is a way to put the cell contents together from the last 4 columns into the complete id column automatically that would be great too.
Any thoughts would be much appreciated!
Best,
Gingerbreadgrl