Firstly I am somewhat of a novice on the subject.

I have created a userform that when filled in, will populate rows on a spreadsheet accordingly for each entry. These entries are related to documents for different departments on different sites. On the Userform the user selects the correct department and site (using combo boxes) which I have then allocated unique numbers for using the "Select Case" function.

What I need is to be able to generate a unique sequential number based on the combobox choices and in turn create a document ID. For example: 182-05-001, 185-05-002. (In this example "182" would represent 'Site A' and "05" represent 'Department 5').

However these numbers should be based on matching criteria rather than just counting up for all documents on the list.

So..
111-03-001
555-03-001
111-03-002
111-03-003
888-05-001

Rather than...
111-03-001
555-03-002
111-03-003
111-03-004
888-05-005


Any help on this will be greatly appreciated.

Apologies if this has been solved else where on the forum but I have failed to find a solution through searches.