VBA to create Sequential number, depending on 3 items chosen from drop down list in Form

Kelley303

New Member
Joined
Sep 13, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello,

I need help! I have created a UserForm to create a document number. The users choose 3 options - Project code, Discipline code, and Doc Type from drop downs. Depending on their choices, I need the next sequential number to populate in the Sequential Number text box on the form.

On my Data spreadsheet:
Column L = the project code
Column M = the discipline code
Column N = Doc Type
Column O = The next sequential number. The number is: 00001 - if the first time those 3 specific items items have been selected and 00002 - if its the second time they have been selected, and so on...

So far, the code I have written allows users to choose from the Project, Discipline and Doc Type options - they Click a 'Create' command button and it populates the data sheet with those 3 codes. I am having trouble writing code that will make the form read each of the 3 conditions (columns) and populate the 'Sequence' text box on the form with the next sequential number.

I am thinking maybe I need a 3 command button process, where first they choose from the 3 drop downs - click create, and then have another command button ('get sequence' ) that would read the each column and then populate the text box - then when they click close the generated sequence number will populate on the actual date sheet?
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top