+ Reply to Thread
Results 1 to 6 of 6

Automatic numbering based on last number

  1. #1
    Registered User
    Join Date
    01-25-2006
    Location
    Poland
    Posts
    9

    Automatic numbering based on last number

    Hi @ll,

    Maybe someone will help me with below.

    I have got 2 sheets:
    - list (list of transactions)
    - accepted (accepted transactions).

    I want to make macro, which will:
    1. select max value from sheet.accepted "B:B"
    2. enter max value +1 in sheet.list "B8"
    3. automatic fill down from B9 to the end of list with number increasing by 1 (in B9=B8+1, in B10=B9+1 etc.)

    I tried with this:
    Please Login or Register  to view this content.
    but of course it's not working (lack of Excel skills).

    Any help would be much appreciated.

    Best,
    Makafi
    Last edited by Makafi; 04-17-2009 at 03:34 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Automatic numbering based on last number

    Maybe something like this:
    Please Login or Register  to view this content.
    It would really help to be able to see what's going on in the "list" sheet. Selecting the range from B8 to ??? is critical and it would help to see what's actually there to start with versus what you want when the macro is done.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    01-25-2006
    Location
    Poland
    Posts
    9

    Re: Automatic numbering based on last number

    Many thanks for your answer!

    This macro gives 'runtime error 6' on the line:
    Please Login or Register  to view this content.
    and I don't know why...

    The problem with "list" sheet is that the number of entries will be different each time. I'm attaching the file.
    Attached Files Attached Files

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Automatic numbering based on last number

    Perhas you could just use:

    Please Login or Register  to view this content.
    Though I'm not sure why you need to constantly reset these... couldn't you just leave them in place all the time ? ie set B8 to =MAX(Accepted!B:B) and the others to be +1 of the prior cell or null if A <> "" ?

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Automatic numbering based on last number

    See, this is why it pays to SEE the data. There's nothing there to replace, so we need to "lastrow" Column A instead. Simple enough.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    01-25-2006
    Location
    Poland
    Posts
    9

    Re: Automatic numbering based on last number

    JBeaucaire, DonkeyOte,

    Many thanks for your help. I'll use JBeaucaire code as it's filling cells with values not formulas, which is was I wanted.

    Again, THANKS!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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