VBA : UserForm : Generate a unique ID Reference no.

RAKESH230583

New Member
Joined
Jan 10, 2011
Messages
46
Hello Friends,

I have one userform used to collect periodic data, Wherein with the help of Application.Username I am able to extract the user details.

But is there any way that we can get the unique ID reference no. on every time the user form is filled and submitted by the user.

Post user save (Command tab) the userform - Message to show with Unique ID reference no . and then after user click on OK the same must be saved on Sheet1 (Data Dump) on Column B.

Example :
21032018001

21 - Date of submission
03 - Current Month
2018 - Current year
001 - Sequence number of data saved on that day.
 
Hello Friends,

I have one userform used to collect periodic data, Wherein with the help of Application.Username I am able to extract the user details.

But is there any way that we can get the unique ID reference no. on every time the user form is filled and submitted by the user.

Post user save (Command tab) the userform - Message to show with Unique ID reference no . and then after user click on OK the same must be saved on Sheet1 (Data Dump) on Column B.

Example :
21032018001

21 - Date of submission
03 - Current Month
2018 - Current year
001 - Sequence number of data saved on that day.



Private Sub UserForm_Initialize()
Me.Label1.Caption = Format(Date, "ddmmyyyy") & Format(ThisWorkbook.Worksheets("Sheet1").Range("A3").Value + 1, "000")

Sheet1.Range("A1") = Date

If Sheet1.Range("A1") <> Sheet1.Range("A2") Then
Sheet1.Range("A3") = 0

End If
End Sub
Private Sub CommandButton1_Click()
Me.Label1.Caption = Format(Date, "ddmmyyyy") & Format(ThisWorkbook.Worksheets("Sheet1").Range("A3").Value + 2, "000")

Sheet1.Range("A3").Value = Sheet1.Range("A3") + 1
Sheet1.Range("A2") = Date
End Sub

Private Sub CommandButton2_Click()
Unload Me
UserForm1.Show

End Sub


this user form have 1 label which show the "Unique ID reference number" and one Command Button which use for "Save" for transection
after save button the "Unique ID reference number" will change automatically
23072023003
23 07 2023 003
the 23 is the Currant day
the 07 is the Currant month
the 2023 is the Currant year
the 003 is the Currant day transection which automatically 001 on next date
 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,215,447
Messages
6,124,907
Members
449,194
Latest member
JayEggleton

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