+ Reply to Thread
Results 1 to 3 of 3

Use this unique ID generator macro to insert into a textbox in a userform

  1. #1
    Registered User
    Join Date
    05-16-2012
    Location
    Utah
    MS-Off Ver
    Excel 2010
    Posts
    31

    Use this unique ID generator macro to insert into a textbox in a userform

    Hello all,

    I am very new to VBA scripting and excel. I thought that buying a big fat 1,100 page book on this stuff would help but i'm still stuck on a certain part. (SEE ATTACHED) Attached is the macro that will look at a column and find the highest number and create that number +1 for the uniqueID of that row. However, I want to be able to (on userform1_initialize), populate the textbox1 in the user form with the value that the macro comes up with (instead of it just populating the selected cell in the workbook.

    This being because my userform that I am currently using (can't share because its got a bunch of confidential data sorry) will input all the info on the userform into multiple tabs in multiple places and I want each entry to have a unique ID that can be used as a reference value throughout the workbook.

    Thanks for any help in advance
    Attached Files Attached Files

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Use this unique ID generator macro to insert into a textbox in a userform

    This code in the userform initialize event
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    05-16-2012
    Location
    Utah
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Use this unique ID generator macro to insert into a textbox in a userform

    Can you explain this to me? I changed it a little for my current sheet but it still comes back with (1) each time.
    Please Login or Register  to view this content.
    I changed the .cells to reflect starting at row 3 in column a. However is it possible to take this following code:
    Please Login or Register  to view this content.
    (minus the msgbox part, i will be getting rid of that once I see the rest is working)
    and reflect the c.value in userform1?
    currently this is in a module. I'm assuming that's the best place for it, but if any of you pro coders know of a better placement, let me know.

    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1