Unique ID genrated when printing.
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Unique ID genrated when printing.

  1. #1
    New Member
    Join Date
    Dec 2017
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Unique ID genrated when printing.

     
    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.

  2. #2
    MrExcel MVP
    Moderator
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    44,439
    Post Thanks / Like
    Mentioned
    29 Post(s)
    Tagged
    4 Thread(s)

    Default Re: Unique ID genrated when printing.

    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
    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

  3. #3
    MrExcel MVP
    Moderator
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    44,439
    Post Thanks / Like
    Mentioned
    29 Post(s)
    Tagged
    4 Thread(s)

    Default Re: Unique ID genrated when printing.

      
    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.
    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com