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.
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
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.
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.