Unique ID genrated when printing.

ash2462

New Member
Joined
Dec 7, 2017
Messages
1
Hi.
I have a permit tow work from created for external engineers attending site in excel.
I would like the form to generate a unique ID when it is printed out or saved.

Is this possible?


Thanks,
Ash.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Welcome to the Board!

How about just using a Date/Time stamp to goes down to the second? That should create a unique ID every time (you could even go down to fractional seconds, if needed).

Here is an example of what that might look like:
Code:
Sub UniqueID()

    Dim myID As String
    
    myID = Format(Now(), "yyyymmddhhnnss")
    MsgBox myID
    
End Sub
 
Upvote 0
Not sure why you sent an email to the Registration email address with your reply (see below):
It needs to be a number that increases by one each time. IE 0001, 0002, 0003 etc.
Just use the "Reply to Thread" at the bottom of each thread to reply.

Just store the counter in a cell somewhere (in a blank cell), increment it each time, and format with four zeroes, i.e.
Code:
Sub CreateInvoiceNum()

    Dim InvoiceNum As String

    Range("Z1") = Range("Z1") + 1
    InvoiceNum = Format(Range("Z1"), "0000")
    MsgBox InvoiceNum
    
End Sub
Also a little tip on posting questions - be detailed! General questions lead to general answers that might not work for you.
You can save a lot of time and back-and-forth by providing lots of detail in your initial question.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,173
Members
453,021
Latest member
Justyna P

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