+ Reply to Thread
Results 1 to 8 of 8

VBA to generate sequential number

  1. #1
    Registered User
    Join Date
    05-14-2015
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    EXCEL 2013
    Posts
    20

    Unhappy VBA to generate sequential number

    Hi, Guys!


    Once more, asking for help!
    I'd like that VBA generated a sequencial number based on inputs of users. For instance, I have the following sequencial catalog format:


    Item-number-type-year


    These are the following variables for item input:
    Screw, flange, winch, crane, wheel, motor


    And these for type input:
    lay, top, bab, cat, lok, kip


    For example this is the first item that I want to catalog, so it would be:
    Screw-001-lay-2016


    So if I enter screw(item) for lay (type) again VBA would create screw-002-lay-2016. If I created the same item for top, it would be screw-001-top-2016.


    Note that all these variable are input by the user on a dialog box, except the Author name that should be copied for column B.


    Could you guys help me achieving this?


    Find the worksheet print and VBA.
    Excel sheet:
    http://postimg.org/image/lc1mlf3eh/

    Please Login or Register  to view this content.
    Thanks!

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA to generate sequential number

    On your userform, which field is Item and which field is type? None of the fields are labeled as such.

    Also, what are those text boxes actually named? (like TextBox1, or fName or whatever)
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Registered User
    Join Date
    05-14-2015
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    EXCEL 2013
    Posts
    20

    Re: VBA to generate sequential number

    Sorry!

    Vessel = item

    Department = Type

    So the only thing generated would be the number!

    I did not get your another question, I'm learning step by step VBA codes.

    Could you help me with that? Attached is the full excel sheet. I coud not upload it in here, so I uploaded it on my Google Drive.
    https://drive.google.com/file/d/0B8q...ew?usp=sharing

    Thnaks!

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA to generate sequential number

    I don't understand if you still want that IUR number filled out in the userform, but I assume you can clean that up if desired.

    Here's the code for the "Add" button as you described you wanted above:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-14-2015
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    EXCEL 2013
    Posts
    20

    Re: VBA to generate sequential number

    Thanks, Walruseggman! It is working as expected!!

    Could you help with something else?

    I want it to still counting + 1 if the Vessel input does not change. For example, no matter what input I make, if the vessel name is always the same, should be added +1 in the sequential number. Another thing, could you change for 3 digits the numbering? I tried to do it, but i did not success at all...

    and last but not least... is that possible to copy only the first 3 letters from vessel input and department input? something like that, if i entry Topazio as vessel and technical as department, the sequential should be TOP-001-TEC-2016.

    Once again, thanks a lot for your support!!

  6. #6
    Registered User
    Join Date
    05-14-2015
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    EXCEL 2013
    Posts
    20

    Re: VBA to generate sequential number

    Anyone?

  7. #7
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA to generate sequential number

    I think I captured everything you requested, let me know if not.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    05-14-2015
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    EXCEL 2013
    Posts
    20

    Re: VBA to generate sequential number

    Thanks a lot walruseggman!

    I was just wondering if it is possible to copy for column C date of IUR number generation and also copy department and vessel (not the shorten format, just the text as written in the userform box) to column D and E respective. One last thing, in the IUR box it is counting 002 for the first. I looked the code and it is couting blanks, could fix that and start couting from 2 row ahead? so that would count only the entries and not the titles as well. Thanks a lot again man!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] generate sequential Number when a sheet is inserted
    By taralmehta15 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2015, 03:28 PM
  2. Generate Sequential number batches
    By ciag in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-08-2015, 10:30 AM
  3. [SOLVED] Generate Sequential Number Only When CommandButton1 Saves As Different File
    By d_striker in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-06-2013, 12:04 PM
  4. How to generate sequential intervals from whole number
    By Mekon in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-14-2013, 04:12 PM
  5. How to generate sequential intervals from whole number
    By Mekon in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-14-2013, 03:59 PM
  6. [SOLVED] excel 2007 - how do i generate a sequential number within an IF formula?
    By tom BTV in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-16-2012, 09:47 AM
  7. Auto Generate Sequential Invoice Number
    By jneldon in forum Excel General
    Replies: 1
    Last Post: 03-09-2009, 01:17 PM

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