Create Unique ID based on previous Unique ID

BarefootPaul

Board Regular
Joined
Jul 21, 2011
Messages
54
I have a table that is updated by a userform with a variety of combo boxes and text boxes. One of the fields in the table is a unique ID (sIRID) based on what the user enters in the userform. It is possible for there to be identical information entered into the userform and thus create identical sIRID's. I want to have the first one be appended with an "a", the second with a "b", etc.

I have tried putting together some things with only limited success.

Code:
sIRID = Left(txtFName.Value, 1) & Left(txtLName.Value, 1) & _
    "IR" & sProgram & sDOI & "a"
'Insert search for sIRID in column F
If 'cell in column F' = sIRID Then
     sIRID = Left(sIRID, 14) & "b"
ElseIf 'Code' = sIRID Then
     sIRID = Left(sIRID, 14) & "b"
Etc, Etc, Etc... (Sorry, I watched the original "The King and I" last night)

This will be part of a larger module that updates the table when a user clicks a cmd button. I am learning VBA as I go, so any help is greatly appreciated.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,224,594
Messages
6,179,795
Members
452,943
Latest member
Newbie4296

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