+ Reply to Thread
Results 1 to 3 of 3

Sequential Numbering

  1. #1
    Registered User
    Join Date
    05-14-2014
    MS-Off Ver
    Excel 2013
    Posts
    14

    Sequential Numbering

    Hello,
    I'm building a VBA userform to enter Grocery Stores names and address information into a worksheet named “Stores”. Each store will have a sequential “store number” in Column A. What I need help on is the VBA code that will automatically create the next available sequential number (“0004” based on sample below) and assign it to a variable or similar, so I can add it to my “save_data_button()” code that I'll have on the userform.

    Although I don’t use the worksheet function; “=LARGE(A:A,1)+1", I see that it's one way to get the next sequential number in column A, but not sure it will work in VBA or if it's the best method.

    I'd appreciate any help or pointer to another post with similar needs.

    Cesar

    Store NO. (A) Store Name (B)
    0001 Safeway
    0002 Savemart
    0003 Winco

  2. #2
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Sequential Numbering

    Calling excel functions within VBA is sometimes the easiest (and most clear) method. I would use MAX instead of LARGE. Example:
    Please Login or Register  to view this content.
    Or, if everything is in VBA, then just use a global variable that keeps it value between calls
    Last edited by alansidman; 05-21-2014 at 04:33 PM.
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

  3. #3
    Registered User
    Join Date
    05-14-2014
    MS-Off Ver
    Excel 2013
    Posts
    14

    Re: Sequential Numbering

    H iPauley, Thanks for the suggestion, it does the job!

+ 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] Sequential Numbering
    By Filtec in forum Excel General
    Replies: 7
    Last Post: 04-15-2013, 04:01 AM
  2. Sequential numbering........................
    By N80RUL in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-12-2013, 10:58 PM
  3. Sequential numbering
    By taylorackley in forum Excel General
    Replies: 2
    Last Post: 08-26-2010, 02:19 PM
  4. Sequential Numbering
    By justin68 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-27-2007, 02:17 AM
  5. sequential numbering
    By super in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-29-2005, 10:39 AM

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